Addition                        0001                              Addition                                                                             Addition                        0002                              ========                                                                             Addition                        0003                                                                                                                   Addition                        0004                                 The plus sign (+) is the operator used to perform addition on                     Addition                        0005                                 numeric data.                                                                     Addition                        0006                                                                                                                   Addition                        0007                                 Notes:                                                                            Addition                        0008                                                                                                                   Addition                        0009                                 1. If the result of an addition operation exceeds the defined                     Addition                        0010                                    length of a receiving numeric variable, the value will be                      Addition                        0011                                    truncated on the left-hand side without warning.                               Addition                        0012                                                                                                                   Addition                        0013                                 2. If the precision of the result exceeds the defined precision                   Addition                        0014                                    of a receiving variable (and the variable has not been defined                 Addition                        0015                                    for automatic rounding), the result will be truncated on the                   Addition                        0016                                    right-hand side. See the <ROUND,#HELPMT3> statement for more                   Addition                        0017                                    information.                                                                   Addition                        0018                                                                                                                   Addition                        0019                                 Also see <the LET statement|LET,#HELPMT4>.                                        Addition                        0020                                                                                                                   Addition                        0021                              Example:                                                                             Addition                        0022                                                                                                                   Addition                        0023                                 LENGTH 5.0                 ! Declare the length for A, B, C                       Addition                        0024                                 LOCAL A, B, C              ! Declare them as LOCAL variables                      Addition                        0025                                 .                                                                                 Addition                        0026                                 LET A = 500                ! Set the value for A                                  Addition                        0027                                 LET B = 2000               ! Set the value for B                                  Addition                        0028                                 LET C = A + B              ! Add A and B, giving C                                Command Mode                    0001                              Command Mode                                                                         Command Mode                    0002                              ============                                                                         Command Mode                    0003                                                                                                                   Command Mode                    0004                                 Command mode is an alternative to interactive mode. In command                    Command Mode                    0005                                 mode, command lines are created to give instructions to the                       Command Mode                    0006                                 compiler program itself. These lines include commands that                        Command Mode                    0007                                 specify the source program name, the object program name, the                     Command Mode                    0008                                 input/output options, and the name of the program to be run after                 Command Mode                    0009                                 the compilation is complete.                                                      Command Mode                    0010                                                                                                                   Command Mode                    0011                                 Specifically, the following compiler commands may be used:                        Command Mode                    0012                                                                                                                   Command Mode                    0013                                 Compiler                                                                          Command Mode                    0014                                 command        Purpose                                                            Command Mode                    0015                                 =================================================================                 Command Mode                    0016                                                                                                                   Command Mode                    0017                                 SOURCE         This option is used to specify the source program                  Command Mode                    0018                                                name.                                                              Command Mode                    0019                                                                                                                   Command Mode                    0020                                                Syntax:                                                            Command Mode                    0021                                                                                                                   Command Mode                    0022                                                SOURCE source-program-name [,directory-name]                       Command Mode                    0023                                                                                                                   Command Mode                    0024                                                The SOURCE command may be abbreviated to the letter                Command Mode                    0025                                                S, spelled-out in part (e.g., SO, SOU), or spelled-                Command Mode                    0026                                                out in full.                                                       Command Mode                    0027                                                                                                                   Command Mode                    0028                                                The source-program-name parameter is the name of the               Command Mode                    0029                                                source program you want to compile.                                Command Mode                    0030                                                                                                                   Command Mode                    0031                                                The directory-name parameter may be used to specify                Command Mode                    0032                                                the directory location of the source program. If                   Command Mode                    0033                                                this parameter is not included, Comet will search                  Command Mode                    0034                                                through the currently accessed directories for the                 Command Mode                    0035                                                source program.                                                    Command Mode                    0036                                                                                                                   Command Mode                    0037                                 OBJECT         This option is used to specify the object program                  Command Mode                    0038                                                name.                                                              Command Mode                    0039                                                                                                                   Command Mode                    0040                                                Syntax:                                                            Command Mode                    0041                                                                                                                   Command Mode                    0042                                                OBJECT object-program-name [,directory]                            Command Mode                    0043                                                                                                                   Command Mode                    0044                                                The OBJECT command may be abbreviated to the letter                Command Mode                    0045                                                O, spelled-out in part (e.g., OB, OBJ), or spelled-                Command Mode                    0046                                                out in full.                                                       Command Mode                    0047                                                                                                                   Command Mode                    0048                                                The object-program-name parameter is the name of the               Command Mode                    0049                                                object program to be created by the compiler.                      Command Mode                    0050                                                                                                                   Command Mode                    0051                                                The directory-name parameter may be used to specify                Command Mode                    0052                                                the directory location for the object program. If                  Command Mode                    0053                                                this parameter is not included, the compiler will                  Command Mode                    0054                                                create the object program on a directory named DSK                 Command Mode                    0055                                                (if one exists). If the specified directory (or the                Command Mode                    0056                                                default directory DSK) does not exist, the compiler                Command Mode                    0057                                                will not create an object file.                                    Command Mode                    0058                                                                                                                   Command Mode                    0059                                 LIST           This option is used to specify the compiler options.               Command Mode                    0060                                                                                                                   Command Mode                    0061                                                Syntax:                                                            Command Mode                    0062                                                                                                                   Command Mode                    0063                                                LIST output-device [,compiler-option] [,compiler-                  Command Mode                    0064                                                option] [,compiler-option]...                                      Command Mode                    0065                                                                                                                   Command Mode                    0066                                                The LIST command may be abbreviated to the letter L,               Command Mode                    0067                                                spelled-out in part (e.g., LI, LIS), or spelled-out                Command Mode                    0068                                                in full.                                                           Command Mode                    0069                                                                                                                   Command Mode                    0070                                                The output-device parameter is used to specify the                 Command Mode                    0071                                                printer or terminal name where the output will be                  Command Mode                    0072                                                directed (e.g., LP1, LP2, T00, SP1). The default                   Command Mode                    0073                                                output device is your terminal.                                    Command Mode                    0074                                                                                                                   Command Mode                    0075                                                The compiler-option parameter is used to specify one               Command Mode                    0076                                                or more compiler options. These options are                        Command Mode                    0077                                                specified by including a comma and the option                      Command Mode                    0078                                                following the output-device parameter.                             Command Mode                    0079                                                                                                                   Command Mode                    0080                                                Option      Description                                            Command Mode                    0081                                                B           byte-align COMMON                                      Command Mode                    0082                                                E           errors only (default)                                  Command Mode                    0083                                                S           source listing                                         Command Mode                    0084                                                X           create cross-reference file                            Command Mode                    0085                                                2           compile for execution under Comet 502                  Command Mode                    0086                                                                                                                   Command Mode                    0087                                                Example:  L LP1,B                                                  Command Mode                    0088                                                                                                                   Command Mode                    0089                                                In this case, the compiler will print a source                     Command Mode                    0090                                                listing on printer LP1, and byte-align the COMMON                  Command Mode                    0091                                                fields.                                                            Command Mode                    0092                                                                                                                   Command Mode                    0093                                 RUN            This option is used to specify the program to be run               Command Mode                    0094                                                after compilation.                                                 Command Mode                    0095                                                                                                                   Command Mode                    0096                                                Syntax:                                                            Command Mode                    0097                                                                                                                   Command Mode                    0098                                                  RUN program-name ["message"]                                     Command Mode                    0099                                                                                                                   Command Mode                    0100                                                The RUN command may be spelled in part or in full                  Command Mode                    0101                                                (e.g., R, RU, RUN).                                                Command Mode                    0102                                                                                                                   Command Mode                    0103                                                The program-name parameter represents the object                   Command Mode                    0104                                                program you want to run after the compiler is done                 Command Mode                    0105                                                compiling your program.                                            Command Mode                    0106                                                                                                                   Command Mode                    0107                                                The message parameter specifies data that is to be                 Command Mode                    0108                                                passed in COMMON to the program-name.                              Command Mode                    0109                                                                                                                   Command Mode                    0110                                                Example:                                                           Command Mode                    0111                                                                                                                   Command Mode                    0112                                                R LISTXREF "SYSTEMA"                                               Command Mode                    0113                                                                                                                   Command Mode                    0114                                                In this example, LISTXREF might be a program that                  Command Mode                    0115                                                processes the cross reference file from the compile                Command Mode                    0116                                                which needs the name of the program just compiled                  Command Mode                    0117                                                (i.e., SYSTEMA).                                                   Command Mode                    0118                                                                                                                   Command Mode                    0119                                 *              This option is used to compile multiple programs in                Command Mode                    0120                                                one command file.                                                  Command Mode                    0121                                                                                                                   Command Mode                    0122                                                * [command-file-name] [,directory] [editor-line-                   Command Mode                    0123                                                number]                                                            Command Mode                    0124                                                                                                                   Command Mode                    0125                                                The asterisk is used to specify that multiple source               Command Mode                    0126                                                programs are to be compiled. In its simplest form,                 Command Mode                    0127                                                the asterisk used by itself (with no parameters)                   Command Mode                    0128                                                indicates that the command file has additional                     Command Mode                    0129                                                compiler commands  the compiler will continue with                Command Mode                    0130                                                the next command in the command file.                              Command Mode                    0131                                                                                                                   Command Mode                    0132                                                The optional parameters with the asterisk command                  Command Mode                    0133                                                can be used to direct the compiler to another                      Command Mode                    0134                                                command file name. In this case, the name of the                   Command Mode                    0135                                                command file, its directory, and even its starting                 Command Mode                    0136                                                editor line number may be specified. This is                       Command Mode                    0137                                                essentially a "GO TO" directive for the compiler                  Command Mode                    0138                                                it passes the direction to an entirely different                   Command Mode                    0139                                                command file name.                                                 Command Mode                    0140                                                                                                                   Command Mode                    0141                                 The compiler command lines may be used in two ways:  they may be                  Command Mode                    0142                                 included at the very beginning of an MTB source program, or they                  Command Mode                    0143                                 may be contained in a separate command file.                                      Command Mode                    0144                                                                                                                   Command Mode                    0145                                 If they are included at the beginning of an MTB source program,                   Command Mode                    0146                                 they should be written as comment lines (i.e., they should start                  Command Mode                    0147                                 with the exclamation mark comment character). For example, the                    Command Mode                    0148                                 following lines could be included at the start of a source                        Command Mode                    0149                                 program:                                                                          Command Mode                    0150                                                                                                                   Command Mode                    0151                                 ! S XSAMPLE,DSK                                                                   Command Mode                    0152                                 ! O SAMPLE,DSK                                                                    Command Mode                    0153                                 ! L LP1                                                                           Command Mode                    0154                                 ! R QMONITOR                                                                      Command Mode                    0155                                 !                                                                                 Command Mode                    0156                                 LENGTH 2 & LOCAL FLAG$                                                            Command Mode                    0157                                 LENGTH 6.0 & LOCAL CRLIMIT                                                        Command Mode                    0158                                 (etc.)                                                                            Command Mode                    0159                                                                                                                   Command Mode                    0160                                 In this case, when the MTB compiler is invoked, the source                        Command Mode                    0161                                 program can also be used as the command file for the compiler;                    Command Mode                    0162                                 the first four lines will be read and used by the compiler as                     Command Mode                    0163                                 command statements. In the example shown, the first four lines                    Command Mode                    0164                                 specify the source program name, the desired object program name,                 Command Mode                    0165                                 the listing device for the compiler output, and the name of the                   Command Mode                    0166                                 program to run after compilation.                                                 Command Mode                    0167                                                                                                                   Command Mode                    0168                                 The Comet editor program (CED) allows you to send a message in                    Command Mode                    0169                                 common memory to the compiler program; the message is the name of                 Command Mode                    0170                                 the command file to be used. For example, you can run the                         Command Mode                    0171                                 compiler using the / command and send it the name of the open                     Command Mode                    0172                                 editor file (a compiler command file), as follows:                                Command Mode                    0173                                                                                                                   Command Mode                    0174                                    /MTB                                                                           Command Mode                    0175                                                                                                                   Command Mode                    0176                                 If you want to compile several programs at once, you can create a                 Command Mode                    0177                                 command file just for this purpose. In this case, the command                     Command Mode                    0178                                 file will not contain MTB source statements, but will just                        Command Mode                    0179                                 contain compiler commands. For example, the following command                     Command Mode                    0180                                 file will result in the compilation of four separate source                       Command Mode                    0181                                 programs:                                                                         Command Mode                    0182                                                                                                                   Command Mode                    0183                                 S XSAMPLE,DSK                                                                     Command Mode                    0184                                 O SAMPLE,DSK                                                                      Command Mode                    0185                                 L LP1                                                                             Command Mode                    0186                                 *                                                                                 Command Mode                    0187                                 S XTEST,DSK                                                                       Command Mode                    0188                                 O TEST,DSK                                                                        Command Mode                    0189                                 L LP1,E                                                                           Command Mode                    0190                                 *                                                                                 Command Mode                    0191                                 S XALPHA,DSK                                                                      Command Mode                    0192                                 O ALPHA,DSK                                                                       Command Mode                    0193                                 L LP2                                                                             Command Mode                    0194                                 *                                                                                 Command Mode                    0195                                 S XBETA,DSK                                                                       Command Mode                    0196                                 O BETA,DSK                                                                        Command Mode                    0197                                 L LP1                                                                             Command Mode                    0198                                 R QMONITOR                                                                        Command Mode                    0199                                                                                                                   Command Mode                    0200                                 Notice that the * command indicates that additional programs are                  Command Mode                    0201                                 to be compiled.                                                                   Command Mode                    0202                                                                                                                   Command Mode                    0203                                 The above command file can be created with the Comet editor and                   Command Mode                    0204                                 used as the compiler command file. This command file can be used                  Command Mode                    0205                                 repeatedly to recompile these four programs. This technique is                    Command Mode                    0206                                 useful for software developers wanting to perform a "mass                         Command Mode                    0207                                 compile" of an entire application package.                                        Command Mode                    0208                                                                                                                   Comment Character               0001                              Comment Character                                                                    Comment Character               0002                              =================                                                                    Comment Character               0003                                                                                                                   Comment Character               0004                                 The exclamation mark (!) is the comment character in MTB source                   Comment Character               0005                                 programs. Whenever it appears on a source line, the MTB compiler                  Comment Character               0006                                 will ignore the remainder of that line.                                           Comment Character               0007                                                                                                                   Comment Character               0008                                 If the exclamation mark is used as the first character on a line,                 Comment Character               0009                                 the entire line will be ignored by the compiler and treated as a                  Comment Character               0010                                 programmer comment.                                                               Comment Character               0011                                                                                                                   Comment Character               0012                                 If the exclamation mark is used anywhere else on a source line,                   Comment Character               0013                                 the first part of the line (up to the exclamation mark) will be                   Comment Character               0014                                 compiled and the remainder of the line will be ignored. This is a                 Comment Character               0015                                 convenient way to place comments on the same line as source                       Comment Character               0016                                 statements.                                                                       Comment Character               0017                                                                                                                   Comment Character               0018                              Example 1:                                                                           Comment Character               0019                                                                                                                   Comment Character               0020                                 !  THIS ENTIRE LINE WILL BE TREATED AS A COMMENT                                  Comment Character               0021                                                                                                                   Comment Character               0022                                 In this example, the whole source line will be ignored because                    Comment Character               0023                                 the comment character appears as the first character on the line.                 Comment Character               0024                                                                                                                   Comment Character               0025                                                                                                                   Comment Character               0026                              Example 2:                                                                           Comment Character               0027                                                                                                                   Comment Character               0028                                 LET A = B*C/D   ! THIS COMMENT FOLLOWS A STATEMENT                                Comment Character               0029                                                                                                                   Comment Character               0030                                 In this example, the comment character follows an executable                      Comment Character               0031                                 statement. The compiler will compile the first part of the line,                  Comment Character               0032                                 but ignore the characters from the exclamation mark to the end of                 Comment Character               0033                                 the line.                                                                         Compiler Directives             0001                              Compiler Directives                                                                  Compiler Directives             0002                              ===================                                                                  Compiler Directives             0003                                                                                                                   Compiler Directives             0004                                 The MTB compiler recognizes three special directives, all                         Compiler Directives             0005                                 intended to make program compilation easier and more convenient.                  Compiler Directives             0006                                 These directives are:                                                             Compiler Directives             0007                                                                                                                   Compiler Directives             0008                                 Directive      Meaning                                                            Compiler Directives             0009                                 =================================================================                 Compiler Directives             0010                                                                                                                   Compiler Directives             0011                                 SET            compile time replacement of symbolic constants                     Compiler Directives             0012                                                                                                                   Compiler Directives             0013                                 USE            compile time merging of auxiliary source statements                Compiler Directives             0014                                                                                                                   Compiler Directives             0015                                 ENDUSE         functional ending of a usefile segment                             Compiler Directives             0016                                                                                                                   Compiler Directives             0017                                 The SET directive is used at the beginning of a source program to                 Compiler Directives             0018                                 establish a specific integer value for a given symbolic constant                  Compiler Directives             0019                                 in the program. For example, consider the following program                       Compiler Directives             0020                                 lines:                                                                            Compiler Directives             0021                                                                                                                   Compiler Directives             0022                                 SET CUSTFILE=1                               ! Set symbolic constan               Compiler Directives             0023                                 .                                                                                 Compiler Directives             0024                                 .                                                                                 Compiler Directives             0025                                 .                                                                                 Compiler Directives             0026                                 OPEN (CUSTFILE) "C1A",EXCP=9999              ! Open customer file                 Compiler Directives             0027                                 .                                                                                 Compiler Directives             0028                                 .                                                                                 Compiler Directives             0029                                 .                                                                                 Compiler Directives             0030                                 READ (CUSTFILE,5000) EXCP=8000               ! Read record                        Compiler Directives             0031                                 .                                                                                 Compiler Directives             0032                                 .                                                                                 Compiler Directives             0033                                 .                                                                                 Compiler Directives             0034                                 WRITE (CUSTFILE,5000) KEY=CUSTNUM$           ! Write record                       Compiler Directives             0035                                                                                                                   Compiler Directives             0036                                 As you can see, the symbolic constant in the above example is the                 Compiler Directives             0037                                 word "CUSTFILE". The SET directive is used to establish the                       Compiler Directives             0038                                 specific integer value for this symbolic constant  in this case,                 Compiler Directives             0039                                 it is a 1.                                                                        Compiler Directives             0040                                                                                                                   Compiler Directives             0041                                 When this program is compiled, the compiler will replace the                      Compiler Directives             0042                                 symbolic constant with the integer.                                               Compiler Directives             0043                                                                                                                   Compiler Directives             0044                                 The SET directive is primarily used to make source program                        Compiler Directives             0045                                 interpretation easier for the programmer. The syntax for the SET                  Compiler Directives             0046                                 directive is:                                                                     Compiler Directives             0047                                                                                                                   Compiler Directives             0048                                    SET symbolic-constant = integer                                                Compiler Directives             0049                                                                                                                   Compiler Directives             0050                                 The USE directive is used to merge auxiliary source statements                    Compiler Directives             0051                                 into the main program at compile time. These auxiliary source                     Compiler Directives             0052                                 statements are collectively called a "usefile."                                   Compiler Directives             0053                                                                                                                   Compiler Directives             0054                                 Usefiles typically contain source program lines that are used in                  Compiler Directives             0055                                 more than one program. Placing these statements in a usefile                      Compiler Directives             0056                                 avoids repetition and also makes it easier to effect a program                    Compiler Directives             0057                                 modification.                                                                     Compiler Directives             0058                                                                                                                   Compiler Directives             0059                                 The syntax for the USE directive is:                                              Compiler Directives             0060                                                                                                                   Compiler Directives             0061                                    USE "usefile-name" [,"directory-name"] [,starting-editor-line-                 Compiler Directives             0062                                    number]                                                                        Compiler Directives             0063                                                                                                                   Compiler Directives             0064                                 The usefile-name parameter is the name of the MTB usefile                         Compiler Directives             0065                                 (enclosed in quotation marks).                                                    Compiler Directives             0066                                                                                                                   Compiler Directives             0067                                 The directory-name parameter is the name of the directory where                   Compiler Directives             0068                                 the usefile is located (also enclosed in quotation marks). This                   Compiler Directives             0069                                 parameter is optional.                                                            Compiler Directives             0070                                                                                                                   Compiler Directives             0071                                 The starting-editor-line-number is the line number in the usefile                 Compiler Directives             0072                                 where the merging is to start. This is used in cases where                        Compiler Directives             0073                                 multiple program segments are contained in a single usefile. In                   Compiler Directives             0074                                 these cases, you must specify the starting editor line number,                    Compiler Directives             0075                                 otherwise the MTB compiler will start at the beginning of the                     Compiler Directives             0076                                 usefile.                                                                          Compiler Directives             0077                                                                                                                   Compiler Directives             0078                                 If you include multiple program segments in a single usefile, be                  Compiler Directives             0079                                 sure to end each segment with the ENDUSE directive. This way, the                 Compiler Directives             0080                                 compiler will merge lines up to the ENDUSE statements, but not                    Compiler Directives             0081                                 beyond.                                                                           Compiler Directives             0082                                                                                                                   Compiler Directives             0083                                 The syntax for the ENDUSE directive is:                                           Compiler Directives             0084                                                                                                                   Compiler Directives             0085                                    ENDUSE                                                                         Compiler Directives             0086                                                                                                                   Compiler Directives             0087                              Special Characters                                                                   Compiler Directives             0088                              ==================                                                                   Compiler Directives             0089                                                                                                                   Compiler Directives             0090                                 There are three special characters that may be included as the                    Compiler Directives             0091                                 first character of a source statement and cause distinct actions                  Compiler Directives             0092                                 by the MTB compiler. These characters are:                                        Compiler Directives             0093                                                                                                                   Compiler Directives             0094                                 Character      Action                                                             Compiler Directives             0095                                 =================================================================                 Compiler Directives             0096                                                                                                                   Compiler Directives             0097                                 #              Forces a form feed on the compiler output.                         Compiler Directives             0098                                                                                                                   Compiler Directives             0099                                 *              On/off switch for source code printout. First                      Compiler Directives             0100                                                occurrence turns the listing off, second occurrence                Compiler Directives             0101                                                turns it back on.                                                  Compiler Directives             0102                                                                                                                   Compiler Directives             0103                                 +              On/off switch for object code printout. First                      Compiler Directives             0104                                                occurrence turns the listing off, second occurrence                Compiler Directives             0105                                                turns it back on.                                                  Compiling MTB Programs          0001                              Compiling MTB Programs                                                               Compiling MTB Programs          0002                              ======================                                                               Compiling MTB Programs          0003                                                                                                                   Compiling MTB Programs          0004                                 <Interactive Mode>                                                                Compiling MTB Programs          0005                                 <Command Mode>                                                                    Compiling MTB Programs          0006                                                                                                                   Compiling MTB Programs          0007                                 Once an MTB source program has been created, the MTB compiler is                  Compiling MTB Programs          0008                                 used to translate this program to object language. The MTB                        Compiling MTB Programs          0009                                 compiler may be used in interactive mode or with the special                      Compiling MTB Programs          0010                                 compiler commands mentioned earlier.                                              Compiling MTB Programs          0011                                                                                                                   Compiling MTB Programs          0012                                 Note: We recommend that you adopt a naming convention for source                  Compiling MTB Programs          0013                                 files and object files. The most common convention is to choose a                 Compiling MTB Programs          0014                                 unique prefix character for all source files and a different                      Compiling MTB Programs          0015                                 unique prefix character for all object files. That way, program                   Compiling MTB Programs          0016                                 names will be easier to remember and locate in a directory                        Compiling MTB Programs          0017                                 listing containing many files.                                                    Compiling MTB Programs          0018                                                                                                                   Compiling MTB Programs          0019                                 For instance, you could choose the letter "X" as a prefix                         Compiling MTB Programs          0020                                 character for your source programs. In that case you would have                   Compiling MTB Programs          0021                                 unique, but similar, names for your source and object programs.                   Compiling MTB Programs          0022                                 For example:                                                                      Compiling MTB Programs          0023                                                                                                                   Compiling MTB Programs          0024                                 Source name    Object name                                                        Compiling MTB Programs          0025                                 ==========================                                                        Compiling MTB Programs          0026                                 XTEST          TEST                                                               Compiling MTB Programs          0027                                 XREPORT        REPORT                                                             Compiling MTB Programs          0028                                 XMENU          MENU                                                               Compiling MTB Programs          0029                                 XMAINT         MAINT                                                              Copyright                       0001                              Copyright Notice                                                                     Copyright                       0002                              ================                                                                     Copyright                       0003                                                                                                                   Copyright                       0004                                 This software package and documentation are copyrighted 1986-1996                 Copyright                       0005                                 by Signature Systems, Inc. All rights reserved worldwide. No part                 Copyright                       0006                                 of this publication may be reproduced, transmitted, transcribed,                  Copyright                       0007                                 stored in any retrieval system, or translated into any language                   Copyright                       0008                                 by any means without the express written permission of Signature                  Copyright                       0009                                 Systems, Inc., 4325 Harrison Grade Road, Sebastopol, CA 95472.                    Copyright                       0010                                                                                                                   Copyright                       0011                              Disclaimer                                                                           Copyright                       0012                              ==========                                                                           Copyright                       0013                                                                                                                   Copyright                       0014                                 Signature Systems, Inc. makes no warranties as to the contents of                 Copyright                       0015                                 this documentation and specifically disclaims any implied                         Copyright                       0016                                 warranties of merchantability or fitness for any particular                       Copyright                       0017                                 purpose. Signature Systems further reserves the right to make                     Copyright                       0018                                 changes to the specifications of the program and contents of the                  Copyright                       0019                                 documentation without obligation to notify any person or                          Copyright                       0020                                 organization of such changes.                                                     Copyright                       0021                                                                                                                   Copyright                       0022                              License Agreement                                                                    Copyright                       0023                              =================                                                                    Copyright                       0024                                                                                                                   Copyright                       0025                                 The software described in this documentation is furnished under a                 Copyright                       0026                                 license agreement and may be used or copied only in accordance                    Copyright                       0027                                 with the terms of the agreement. Failure to sign this agreement                   Copyright                       0028                                 and still use the software is illegal.                                            Copyright                       0029                                                                                                                   Copyright                       0030                              Trademark Credits                                                                    Copyright                       0031                              =================                                                                    Copyright                       0032                                                                                                                   Copyright                       0033                                 Trademarks used in this manual belong to their respective owners.                 Copyright                       0034                                                                                                                   Copyright                       0035                              Publication Information                                                              Copyright                       0036                              =======================                                                              Copyright                       0037                                                                                                                   Copyright                       0038                                 First on-line edition September 1996.                                             Creating MTB Source Programs    0001                              Creating MTB Source Programs                                                         Creating MTB Source Programs    0002                              ============================                                                         Creating MTB Source Programs    0003                                                                                                                   Creating MTB Source Programs    0004                                 MTB source programs are created in one of two ways. While working                 Creating MTB Source Programs    0005                                 in the Comet environment, the Comet editor utility (a program                     Creating MTB Source Programs    0006                                 named CED) may be used to create an MTB source program. Outside                   Creating MTB Source Programs    0007                                 of the Comet environment, virtually any text editor or word                       Creating MTB Source Programs    0008                                 processor may be used to create an MTB source program.                            Creating MTB Source Programs    0009                                                                                                                   Creating MTB Source Programs    0010                                 The MTB compiler recognizes Comet editor files and text files as                  Creating MTB Source Programs    0011                                 source files, so feel free to choose the editing method you                       Creating MTB Source Programs    0012                                 prefer.                                                                           Creating MTB Source Programs    0013                                                                                                                   Creating MTB Source Programs    0014                                 The CED program creates a Comet keyed file with a record size of                  Creating MTB Source Programs    0015                                 94 bytes and key size of 7 bytes. The data records contains MTB                   Creating MTB Source Programs    0016                                 statements (up to 80 bytes) followed by an exclamation mark and 7                 Creating MTB Source Programs    0017                                 bytes representing the editor line number. The associated key                     Creating MTB Source Programs    0018                                 contains the editor line number as well. For information, see the                 Creating MTB Source Programs    0019                                 <CED documentation,#HELPCED>.                                                     Creating MTB Source Programs    0020                                                                                                                   Creating MTB Source Programs    0021                                 Source programs created outside of the Comet environment are                      Creating MTB Source Programs    0022                                 created as "text" files. Numerous programs exist to create text                   Creating MTB Source Programs    0023                                 files, including the DOS standard EDIT program and a number of                    Creating MTB Source Programs    0024                                 word processing programs that can save files as ASCII text files.                 Creating MTB Source Programs    0025                                 Note:  If you create your MTB source programs as text files, you                  Creating MTB Source Programs    0026                                 must include them in the Comet directory file (QDIR) before you                   Creating MTB Source Programs    0027                                 compile the program. Refer to the DIRMAINT utility program for                    Creating MTB Source Programs    0028                                 additional information.                                                           Creating MTB Source Programs    0029                                                                                                                   Creating MTB Source Programs    0030                                 Many MTB programs employ a convenient feature of the MTB                          Creating MTB Source Programs    0031                                 compiler, the inclusion of compiler commands in the source                        Creating MTB Source Programs    0032                                 program itself. Therefore, some of the examples in this                           Creating MTB Source Programs    0033                                 documentation include lines at the beginning of the program --                    Creating MTB Source Programs    0034                                 commands that are processed by the MTB compiler during the                        Creating MTB Source Programs    0035                                 compilation of the program.                                                       Creating MTB Source Programs    0036                                                                                                                   Creating MTB Source Programs    0037                                 Also see <Compiling MTB Programs>                                                 Data Types                      0001                              Data Types                                                                           Data Types                      0002                              ==========                                                                           Data Types                      0003                                                                                                                   Data Types                      0004                                 The MTB language supports two data types: string and numeric.                     Data Types                      0005                                 String data may include alphanumeric characters, special                          Data Types                      0006                                 characters, and hex values. Numeric data may include digits, a                    Data Types                      0007                                 decimal point, and a minus sign only.                                             Data Types                      0008                                                                                                                   Data Types                      0009                                 String data                                                                       Data Types                      0010                                 ===========                                                                       Data Types                      0011                                                                                                                   Data Types                      0012                                 String data may be classified as constant or variable. String                     Data Types                      0013                                 constants (sometimes called string literals) are characters                       Data Types                      0014                                 enclosed in quotation marks (single or double). String constants                  Data Types                      0015                                 may contains up to 254 characters. For example, the following are                 Data Types                      0016                                 considered as string constants:                                                   Data Types                      0017                                                                                                                   Data Types                      0018                                 String constant                  Explanation                                      Data Types                      0019                                 =================================================================                 Data Types                      0020                                 "Signature Systems, Inc."        alphabetic characters                            Data Types                      0021                                 "4325 Harrison Grade Road"       alphanumeric characters                          Data Types                      0022                                 "(707) 874-1250"                 alphanumeric and special character               Data Types                      0023                                 "@FF@"                           hex constant FF                                  Data Types                      0024                                 "@2020@"                         hex constant 2020                                Data Types                      0025                                                                                                                   Data Types                      0026                                 String variables are named memory locations used to store string                  Data Types                      0027                                 data (up to 254 characters per variable). In MTB, string variable                 Data Types                      0028                                 names may be any number of characters long, although the compiler                 Data Types                      0029                                 recognizes only the first 30 characters of the name. String                       Data Types                      0030                                 variable names may be upper or lower case, may include imbedded                   Data Types                      0031                                 decimal points, and must end with a dollar sign ($) character.                    Data Types                      0032                                 They may not include imbedded blanks or other special characters.                 Data Types                      0033                                 For example, the following are valid string variable names:                       Data Types                      0034                                                                                                                   Data Types                      0035                                    CUSTOMER$               customer$                                              Data Types                      0036                                    PARTNUMBER$             Part.number$      part.number$                         Data Types                      0037                                    A$                      a$                                                     Data Types                      0038                                    VALUE1$                 value1$                                                Data Types                      0039                                    CITYSTATEZIPCODE$       City.State.ZIP$                                        Data Types                      0040                                                                                                                   Data Types                      0041                                 In MTB, all variables must be defined before they can be used.                    Data Types                      0042                                 These definitions include the variable name, type (string or                      Data Types                      0043                                 numeric), length, and classification. For more information, see                   Data Types                      0044                                 the <Data Division,#HELPMT3> documentation.                                       Data Types                      0045                                                                                                                   Data Types                      0046                                 Numeric data                                                                      Data Types                      0047                                 ============                                                                      Data Types                      0048                                                                                                                   Data Types                      0049                                 Numeric data may also be classified as constant or variable.                      Data Types                      0050                                 Numeric constants are fixed numeric values included in a program;                 Data Types                      0051                                 they may contain digits, a decimal point, and a trailing minus                    Data Types                      0052                                 sign. Commas are not allowed in numeric constants. Numeric                        Data Types                      0053                                 constants may contain up to 16 digits, 15 of which may be located                 Data Types                      0054                                 to the right side of the decimal point. For example, the                          Data Types                      0055                                 following values are numeric constants:                                           Data Types                      0056                                                                                                                   Data Types                      0057                                    100                                                                            Data Types                      0058                                    1234.56                                                                        Data Types                      0059                                    2500.9999-                                                                     Data Types                      0060                                    1.234567890123456                                                              Data Types                      0061                                    1234567890123456.                                                              Data Types                      0062                                                                                                                   Data Types                      0063                                 Numeric variables are named memory locations used to store                        Data Types                      0064                                 numeric data (up to 16 digits per variable). In MTB, numeric                      Data Types                      0065                                 variable names may be any number of characters long, although the                 Data Types                      0066                                 compiler recognizes only the first 30 characters of the name.                     Data Types                      0067                                 Numeric variable names may be upper or lower case and may include                 Data Types                      0068                                 imbedded decimal points. They may not include imbedded blanks or                  Data Types                      0069                                 other special characters. For example, the following are valid                    Data Types                      0070                                 numeric variable names:                                                           Data Types                      0071                                                                                                                   Data Types                      0072                                    CREDITLIMIT             Credit.limit                                           Data Types                      0073                                    AROVER120               AR.over.120                                            Data Types                      0074                                    INVENTORYVALUE          inventory.value                                        Data Types                      0075                                    X                       x                                                      Data Types                      0076                                    AMOUNT                  amount                                                 Data Types                      0077                                                                                                                   Data Types                      0078                                 In MTB, all variables must be defined before they can be used.                    Data Types                      0079                                 These definitions include the variable name, type (string or                      Data Types                      0080                                 numeric), length, and classification. For more information, see                   Data Types                      0081                                 the <Data Division,#HELPMT3> documentation.                                       Division                        0001                              Division                                                                             Division                        0002                              ========                                                                             Division                        0003                                                                                                                   Division                        0004                                 The backslash (/) is the operator used to perform division on                     Division                        0005                                 numeric data.                                                                     Division                        0006                                                                                                                   Division                        0007                                 Notes:                                                                            Division                        0008                                                                                                                   Division                        0009                                 1. If the result of a division operation exceeds the defined                      Division                        0010                                    length of a receiving numeric variable, the value will be                      Division                        0011                                    truncated on the left-hand side without warning.                               Division                        0012                                                                                                                   Division                        0013                                 2. If the precision of the result exceeds the defined precision                   Division                        0014                                    of a receiving variable (and the variable has not been defined                 Division                        0015                                    for automatic rounding), the result will be truncated on the                   Division                        0016                                    right-hand side. See the <ROUND,#HELPMT3> statement for more                   Division                        0017                                    information.                                                                   Division                        0018                                                                                                                   Division                        0019                                 Also see <the LET statement|LET,#HELPMT4>.                                        Division                        0020                                                                                                                   Division                        0021                              Example:                                                                             Division                        0022                                                                                                                   Division                        0023                                 LENGTH 5.0                 ! Declare the length for A, B, C                       Division                        0024                                 LOCAL A, B, C              ! Declare them as LOCAL variables                      Division                        0025                                 .                                                                                 Division                        0026                                 LET A = 150                ! Set the value for A                                  Division                        0027                                 LET B = 25                 ! Set the value for B                                  Division                        0028                                 LET C = A / B              ! Divide A by B, giving C                              File I/O Operations             0001                              File I/O Operations                                                                  File I/O Operations             0002                              ===================                                                                  File I/O Operations             0003                                                                                                                   File I/O Operations             0004                                 The MTB language provides over twenty statements related to file                  File I/O Operations             0005                                 input and output operations. These are explained in detail in the                 File I/O Operations             0006                                 <Procedure Division,#HELPMT4> documentation.                                      File I/O Operations             0007                                                                                                                   File I/O Operations             0008                                 Below is a brief summary of the most common file operations. Note                 File I/O Operations             0009                                 that some of these operations may not be performed simultaneously                 File I/O Operations             0010                                 by multiple users, or actions taken by one user could affect file                 File I/O Operations             0011                                 operations attempted by another.                                                  File I/O Operations             0012                                                                                                                   File I/O Operations             0013                                 At the highest level, MTB file operations include statements to                   File I/O Operations             0014                                 open, close, create, erase, rename, lock, and unlock a file,                      File I/O Operations             0015                                 including:                                                                        File I/O Operations             0016                                                                                                                   File I/O Operations             0017                                    <CREATE,#HELPMT4>                                                              File I/O Operations             0018                                    <ERASE,#HELPMT4>                                                               File I/O Operations             0019                                    <RENAME,#HELPMT4>                                                              File I/O Operations             0020                                    <OPEN,#HELPMT4>                                                                File I/O Operations             0021                                    <CLOSE,#HELPMT4>                                                               File I/O Operations             0022                                    <LOCK,#HELPMT4>                                                                File I/O Operations             0023                                    <UNLOCK,#HELPMT4>                                                              File I/O Operations             0024                                                                                                                   File I/O Operations             0025                                 Once a data file is created and opened, normal I/O operations may                 File I/O Operations             0026                                 proceed. MTB provides statements for reading records, writing                     File I/O Operations             0027                                 records, reading and locking records, deleting records, etc.                      File I/O Operations             0028                                 Theses include:                                                                   File I/O Operations             0029                                                                                                                   File I/O Operations             0030                                    <WRITE,#HELPMT4>                                                               File I/O Operations             0031                                    <READ,#HELPMT4>                                                                File I/O Operations             0032                                    <EXTRACT,#HELPMT4>                                                             File I/O Operations             0033                                    <INQUIRE,#HELPMT4>                                                             File I/O Operations             0034                                    <DELETE,#HELPMT4>                                                              File I/O Operations             0035                                                                                                                   File I/O Operations             0036                                 MTB also provides statements for inserting, rewriting, and                        File I/O Operations             0037                                 updating data records, including:                                                 File I/O Operations             0038                                                                                                                   File I/O Operations             0039                                    <UPDATE,#HELPMT4>                                                              File I/O Operations             0040                                    <INSERT,#HELPMT4>                                                              File I/O Operations             0041                                    <REWRITE,#HELPMT4>                                                             File I/O Operations             0042                                                                                                                   File I/O Operations             0043                                 In addition to these direct input/output statements, MTB provides                 File I/O Operations             0044                                 several file functions, including:                                                File I/O Operations             0045                                                                                                                   File I/O Operations             0046                                    <FIRST,#HELPMT4>                                                               File I/O Operations             0047                                    <LAST,#HELPMT4>                                                                File I/O Operations             0048                                    <KEY,#HELPMT4>                                                                 File I/O Operations             0049                                    <POSITION,#HELPMT4>                                                            File I/O Operations             0050                                    <PREV,#HELPMT4>                                                                File I/O Operations             0051                                    <ORD,#HELPMT4>                                                                 HOME                            0001                              Table of Contents                                                                    HOME                            0002                              =================                                                                    HOME                            0003                                                                                                                   HOME                            0004                                 <Introduction to MoreThanBasic,#HELPMT2>                                          HOME                            0005                                 <Language Structure,#HELPMT2>                                                     HOME                            0006                                    <Data Division,#HELPMT3>                                                       HOME                            0007                                    <I/O Format Division,#HELPMT3>                                                 HOME                            0008                                    <Procedure Division,#HELPMT4>                                                  HOME                            0009                                 <Overview of the Comet File System,#HELPMT2>                                      HOME                            0010                                 <Using the MTB Compiler,#HELPMT2>                                                 HOME                            0011                                 <MTB Applications,#HELPMT5>                                                       HOME                            0012                                 <Instant Reference Guide,#HELPMT6>                                                HOME                            0013                                 <Index|INDEX,#HELPMTB>                                                            Indentation                     0001                              Indentation                                                                          Indentation                     0002                              ===========                                                                          Indentation                     0003                                                                                                                   Indentation                     0004                                 MTB statements may start at any position on the line. For more                    Indentation                     0005                                 readable source code, you may indent instructions in order to                     Indentation                     0006                                 highlight statement labels, illustrate loop constructs, show                      Indentation                     0007                                 nested structures, etc.                                                           Indentation                     0008                                                                                                                   Indentation                     0009                              Example 1:                                                                           Indentation                     0010                                                                                                                   Indentation                     0011                                 Before                                                                            Indentation                     0012                                 ======                                                                            Indentation                     0013                                                                                                                   Indentation                     0014                                 FOR HALFS=0 TO 2                                                                  Indentation                     0015                                 FOR QUARTERS=0 TO 4                                                               Indentation                     0016                                 FOR DIMES=0 TO 10                                                                 Indentation                     0017                                 FOR NICKELS=0 TO 20                                                               Indentation                     0018                                 FOR PENNIES=0 TO 100                                                              Indentation                     0019                                 TOTAL=HALFS*50+QUARTERS*25+DIMES*10+NICKELS*5+PENNIES                             Indentation                     0020                                 IF TOTAL = 100 THEN PRINT (0,1000)                                                Indentation                     0021                                 NEXT PENNIES                                                                      Indentation                     0022                                 NEXT NICKELS                                                                      Indentation                     0023                                 NEXT DIMES                                                                        Indentation                     0024                                 NEXT QUARTERS                                                                     Indentation                     0025                                 NEXT HALFS                                                                        Indentation                     0026                                                                                                                   Indentation                     0027                                 After                                                                             Indentation                     0028                                 =====                                                                             Indentation                     0029                                                                                                                   Indentation                     0030                                 FOR HALFS=0 TO 2                                                                  Indentation                     0031                                   FOR QUARTERS=0 TO 4                                                             Indentation                     0032                                     FOR DIMES=0 TO 10                                                             Indentation                     0033                                       FOR NICKELS=0 TO 20                                                         Indentation                     0034                                         FOR PENNIES=0 TO 100                                                      Indentation                     0035                                           TOTAL=HALFS*50+QUARTERS*25+DIMES*10+NICKELS*5+PENNIES                   Indentation                     0036                                           IF TOTAL = 100 THEN PRINT (0,1000)                                      Indentation                     0037                                         NEXT PENNIES                                                              Indentation                     0038                                       NEXT NICKELS                                                                Indentation                     0039                                     NEXT DIMES                                                                    Indentation                     0040                                   NEXT QUARTERS                                                                   Indentation                     0041                                 NEXT HALFS                                                                        Indentation                     0042                                                                                                                   Indentation                     0043                              Example 2:                                                                           Indentation                     0044                                                                                                                   Indentation                     0045                                 Before                                                                            Indentation                     0046                                 ======                                                                            Indentation                     0047                                                                                                                   Indentation                     0048                                 PRINT (0) (ET)                                                                    Indentation                     0049                                 LABEL: PRINT (0) "WELCOME TO THE PROGRAM."                                        Indentation                     0050                                 PRINT (0) "WHAT IS YOUR NAME?"                                                    Indentation                     0051                                 INPUT (0) NAME$                                                                   Indentation                     0052                                 .                                                                                 Indentation                     0053                                 .                                                                                 Indentation                     0054                                 GOTO LABEL                                                                        Indentation                     0055                                                                                                                   Indentation                     0056                                 After                                                                             Indentation                     0057                                 ======                                                                            Indentation                     0058                                                                                                                   Indentation                     0059                                          PRINT (0) (ET)                                                           Indentation                     0060                                 LABEL:   PRINT (0) "WELCOME TO THE PROGRAM."                                      Indentation                     0061                                          PRINT (0) "WHAT IS YOUR NAME?"                                           Indentation                     0062                                          INPUT (0) NAME$                                                          Indentation                     0063                                          .                                                                        Indentation                     0064                                          .                                                                        Indentation                     0065                                          GOTO LABEL                                                               Indentation                     0066                                                                                                                   Indentation                     0067                              Example 3:                                                                           Indentation                     0068                                                                                                                   Indentation                     0069                                 Before                                                                            Indentation                     0070                                 ======                                                                            Indentation                     0071                                                                                                                   Indentation                     0072                                 IF ENTERLEVEL = 0                                                                 Indentation                     0073                                 RUN "QMONITOR"                                                                    Indentation                     0074                                 ELSE                                                                              Indentation                     0075                                 EXIT                                                                              Indentation                     0076                                 ENDIF                                                                             Indentation                     0077                                                                                                                   Indentation                     0078                                 After                                                                             Indentation                     0079                                 =====                                                                             Indentation                     0080                                                                                                                   Indentation                     0081                                 IF ENTERLEVEL = 0                                                                 Indentation                     0082                                    RUN "QMONITOR"                                                                 Indentation                     0083                                 ELSE                                                                              Indentation                     0084                                    EXIT                                                                           Indentation                     0085                                 ENDIF                                                                             Indexed Sequential files        0001                              Indexed Sequential files                                                             Indexed Sequential files        0002                              ========================                                                             Indexed Sequential files        0003                                                                                                                   Indexed Sequential files        0004                                 Records in indexed sequential files are stored in the order that                  Indexed Sequential files        0005                                 they are written to the disk. Records may be retrieved in                         Indexed Sequential files        0006                                 sequential order or in random order using a numeric index to                      Indexed Sequential files        0007                                 represent the record number in the file.                                          Indexed Sequential files        0008                                                                                                                   Indexed Sequential files        0009                                 The record size, specified when the file is created, may range                    Indexed Sequential files        0010                                 from 1 to 1,024 bytes.                                                            Indexed Sequential files        0011                                                                                                                   Indexed Sequential files        0012                                 When an MTB program opens an indexed sequential file, the Comet                   Indexed Sequential files        0013                                 operating system assigns a unique record pointer to the file.                     Indexed Sequential files        0014                                 Each user opening the file is assigned a unique pointer, allowing                 Indexed Sequential files        0015                                 multiple users to access data from the same file at the same                      Indexed Sequential files        0016                                 time. To avoid data integrity problems when more than one user is                 Indexed Sequential files        0017                                 accessing a file, MTB provides a record locking mechanism. The                    Indexed Sequential files        0018                                 <EXTRACT,#HELPMT4> statement is used to read and lock individual                  Indexed Sequential files        0019                                 data records.                                                                     Indexed Sequential files        0020                                                                                                                   Indexed Sequential files        0021                                 When an indexed sequential file is opened, the record pointer is                  Indexed Sequential files        0022                                 positioned at the first record. Subsequent I/O operations change                  Indexed Sequential files        0023                                 the location of the pointer. Note: Some I/O operations do not                     Indexed Sequential files        0024                                 move the pointer. See the <Procedure Division,#HELPMT4>.                          Indexed Sequential files        0025                                                                                                                   Indexed Sequential files        0026                                 For example, to read all the records from an indexed sequential                   Indexed Sequential files        0027                                 file in order, you would open the file and read the records                       Indexed Sequential files        0028                                 without specifying an index. This would move through the file in                  Indexed Sequential files        0029                                 sequential order and end when the last record was read.                           Indexed Sequential files        0030                                                                                                                   Indexed Sequential files        0031                                 To read a specific record from an indexed sequential file, you                    Indexed Sequential files        0032                                 would include the <KEY=,#HELPMT4> parameter in the                                Indexed Sequential files        0033                                 <READ,#HELPMT4> (or associated input) statement. The "key" in                     Indexed Sequential files        0034                                 this case would be a specific record number (e.g., the number 35                  Indexed Sequential files        0035                                 would represent the 35th record in the file). The direct access                   Indexed Sequential files        0036                                 to a record moves the record pointer, so that subsequent                          Indexed Sequential files        0037                                 sequential access would take place from the new record pointer                    Indexed Sequential files        0038                                 location, rather than the beginning of the file.                                  Indexed Sequential files        0039                                                                                                                   Indexed Sequential files        0040                                 Application note: Indexed sequential files are commonly used for                  Indexed Sequential files        0041                                 transaction files because they take less disk space than keyed                    Indexed Sequential files        0042                                 files, and are faster to read from beginning to end than a keyed                  Indexed Sequential files        0043                                 file.                                                                             Indexed Sequential files        0044                                                                                                                   Indexed Sequential files        0045                                 Also see <Record Types>.                                                          Interactive Mode                0001                              Interactive Mode                                                                     Interactive Mode                0002                              ================                                                                     Interactive Mode                0003                                                                                                                   Interactive Mode                0004                                 To execute the MTB compiler from the READY prompt of the QMONITOR                 Interactive Mode                0005                                 program, type MTB. The following prompts are displayed:                           Interactive Mode                0006                                                                                                                   Interactive Mode                0007                                 Command File:                                                                     Interactive Mode                0008                                                                                                                   Interactive Mode                0009                                    If you are using a command file to control the compiler, enter                 Interactive Mode                0010                                    the command file name, and (optionally) a comma and the Comet                  Interactive Mode                0011                                    directory where the command file is located. For more                          Interactive Mode                0012                                    information on MTB command files, see the following pages.                     Interactive Mode                0013                                                                                                                   Interactive Mode                0014                                    If you are not using a command file, press Enter to proceed to                 Interactive Mode                0015                                    the next prompt.                                                               Interactive Mode                0016                                                                                                                   Interactive Mode                0017                                 Source File:                                                                      Interactive Mode                0018                                                                                                                   Interactive Mode                0019                                    Enter the name of the source program to be compiled. You may                   Interactive Mode                0020                                    enter up to 12 characters (eight for the source file name, one                 Interactive Mode                0021                                    for a comma, and three for the directory where the source file                 Interactive Mode                0022                                    is located). If you do not enter a directory name, the                         Interactive Mode                0023                                    compiler will search through the currently accessed Comet                      Interactive Mode                0024                                    directories for the source file.                                               Interactive Mode                0025                                                                                                                   Interactive Mode                0026                                    If you press the Enter key without typing anything, the                        Interactive Mode                0027                                    program will exit back to the READY prompt of the QMONITOR                     Interactive Mode                0028                                    program.                                                                       Interactive Mode                0029                                                                                                                   Interactive Mode                0030                                 Object File:                                                                      Interactive Mode                0031                                                                                                                   Interactive Mode                0032                                    Enter the name of the object program to be created. You may                    Interactive Mode                0033                                    enter up to 12 characters (eight for the object file name, one                 Interactive Mode                0034                                    for a comma, and three for the directory where the object                      Interactive Mode                0035                                    program is to be created). If you do not enter a directory                     Interactive Mode                0036                                    name, the compiler will create the object program on a                         Interactive Mode                0037                                    directory named DSK (if one exists).                                           Interactive Mode                0038                                                                                                                   Interactive Mode                0039                                 Listing File:                                                                     Interactive Mode                0040                                                                                                                   Interactive Mode                0041                                    Enter the device name where the compiler listing will be                       Interactive Mode                0042                                    printed or displayed. The default listing device is your                       Interactive Mode                0043                                    terminal. (Note:  In previous versions of the MTB compiler,                    Interactive Mode                0044                                    the default listing device was the printer named LP1.)                         Interactive Mode                0045                                                                                                                   Interactive Mode                0046                                 Options:                                                                          Interactive Mode                0047                                                                                                                   Interactive Mode                0048                                    Enter the compiler options you would like to use. These                        Interactive Mode                0049                                    include the following:                                                         Interactive Mode                0050                                                                                                                   Interactive Mode                0051                                    Option      Description                                                        Interactive Mode                0052                                    =======================                                                        Interactive Mode                0053                                    B           byte-align COMMON                                                  Interactive Mode                0054                                    E           errors only (default)                                              Interactive Mode                0055                                    S           source listing                                                     Interactive Mode                0056                                    X           create cross-reference file                                        Interactive Mode                0057                                    2           compile for execution under Comet 502                              Interactive Mode                0058                                                                                                                   Interactive Mode                0059                                    These options are explained below.                                             Interactive Mode                0060                                                                                                                   Interactive Mode                0061                                    Note that you may use compiler options in three places:                        Interactive Mode                0062                                                                                                                   Interactive Mode                0063                                    1.    at this prompt                                                           Interactive Mode                0064                                    2.    in a command file (i.e., !L T00,S,X)                                     Interactive Mode                0065                                    3.    in the "#MTB" compiler options file (see below for more                  Interactive Mode                0066                                          information).                                                            Interactive Mode                0067                                                                                                                   Interactive Mode                0068                                 Above Correct?                                                                    Interactive Mode                0069                                                                                                                   Interactive Mode                0070                                    If your file names, listing devices, and compile options are                   Interactive Mode                0071                                    correct, type Y and press the Enter key to begin compilation.                  Interactive Mode                0072                                    Otherwise, type N to re-enter the above fields.                                Interactive Mode                0073                                                                                                                   Interactive Mode                0074                              Compiler options                                                                     Interactive Mode                0075                                                                                                                   Interactive Mode                0076                                 The MTB compiler supports several optional parameters. These                      Interactive Mode                0077                                 control memory allocation, the listing device, and the type of                    Interactive Mode                0078                                 listing the compiler will produce. These options may be used in                   Interactive Mode                0079                                 interactive mode (see previous page), in an MTB command file list                 Interactive Mode                0080                                 command (see below for more information), or in the "#MTB"                        Interactive Mode                0081                                 compiler options file (see below for more information).                           Interactive Mode                0082                                                                                                                   Interactive Mode                0083                                 Option   Description                                                              Interactive Mode                0084                                 =================================================================                 Interactive Mode                0085                                                                                                                   Interactive Mode                0086                                 B        Byte-align COMMON                                                        Interactive Mode                0087                                                                                                                   Interactive Mode                0088                                          The MTB compiler's default method of aligning data                       Interactive Mode                0089                                          elements is based on word boundaries. This function is                   Interactive Mode                0090                                          normally transparent to the user and was included in the                 Interactive Mode                0091                                          original MTB compiler to speed up data retrieval and                     Interactive Mode                0092                                          storage. With today's hardware, word boundaries are no                   Interactive Mode                0093                                          longer a factor in operating speed. Because word                         Interactive Mode                0094                                          alignment could result in an additional byte being                       Interactive Mode                0095                                          allocated for each data element defined, we have added a                 Interactive Mode                0096                                          new option to the MTB compiler.                                          Interactive Mode                0097                                                                                                                   Interactive Mode                0098                                          The "B" option causes the MTB compiler to "byte-align"                   Interactive Mode                0099                                          the COMMON data variables declared in your program. The                  Interactive Mode                0100                                          "B" option reduces memory requirements and also allows                   Interactive Mode                0101                                          you to intermix MTB and QICBASIC object programs                         Interactive Mode                0102                                          (QICBASIC programs use byte-aligned fields).                             Interactive Mode                0103                                                                                                                   Interactive Mode                0104                                          The default data alignment method for the compiler                       Interactive Mode                0105                                          remains "not byte-aligned."  This option lets you                        Interactive Mode                0106                                          override the default.                                                    Interactive Mode                0107                                                                                                                   Interactive Mode                0108                                          Caution: Programs using COMMON data fields must all be                   Interactive Mode                0109                                          compiled with the same data alignment method (the default                Interactive Mode                0110                                          or the "B" option); if not, your programs' COMMON data                   Interactive Mode                0111                                          will be garbled.                                                         Interactive Mode                0112                                                                                                                   Interactive Mode                0113                                 E        Errors only (default)                                                    Interactive Mode                0114                                                                                                                   Interactive Mode                0115                                          The "E" option causes the MTB compiler to produce an                     Interactive Mode                0116                                          errors-only listing when a program is compiled. The "E"                  Interactive Mode                0117                                          option is the default listing option.                                    Interactive Mode                0118                                                                                                                   Interactive Mode                0119                                 S        Source listing                                                           Interactive Mode                0120                                                                                                                   Interactive Mode                0121                                          The "S" option causes the MTB compiler to produce a                      Interactive Mode                0122                                          source code listing when a program is compiled. If                       Interactive Mode                0123                                          compiler errors are present, they will be printed and                    Interactive Mode                0124                                          underlined with a rows of asterisks.                                     Interactive Mode                0125                                                                                                                   Interactive Mode                0126                                 X        Write to Cross Reference File                                            Interactive Mode                0127                                                                                                                   Interactive Mode                0128                                          This option causes cross reference information to be                     Interactive Mode                0129                                          written to data file on the same directory as the source                 Interactive Mode                0130                                          file. The cross-reference file is named "MXREFxxx", where                Interactive Mode                0131                                          "xxx" is the user's partition number.                                    Interactive Mode                0132                                                                                                                   Interactive Mode                0133                                          The compiler erases "MXREFxxx" and creates a new one each                Interactive Mode                0134                                          time MTB is invoked by the user, but adds to it when                     Interactive Mode                0135                                          successive compilations are performed using a command                    Interactive Mode                0136                                          file. This permits the user to obtain a comprehensive                    Interactive Mode                0137                                          cross reference of all programs in a system, if desired.                 Interactive Mode                0138                                                                                                                   Interactive Mode                0139                                          The cross-reference file is a sequential file with 756-                  Interactive Mode                0140                                          byte records. Each record contains 27 entries of 28 bytes                Interactive Mode                0141                                          each. The entry format is:                                               Interactive Mode                0142                                                                                                                   Interactive Mode                0143                                          Field             Size  Description                                      Interactive Mode                0144                                                                                                                   Interactive Mode                0145                                          Symbol            8     The symbol or statement label.                   Interactive Mode                0146                                                                                                                   Interactive Mode                0147                                          String flag       1     "$" if a string field, otherwise                 Interactive Mode                0148                                                                  blank. Note: This byte can duplica               Interactive Mode                0149                                                                  the "$" in the symbol field if the               Interactive Mode                0150                                                                  symbol is less than 8 characters.                Interactive Mode                0151                                                                                                                   Interactive Mode                0152                                          Sort control      1     0 for symbol definitions, 1 for                  Interactive Mode                0153                                                                  references *                                     Interactive Mode                0154                                                                                                                   Interactive Mode                0155                                          File name         8     Name of source file or usefile.                  Interactive Mode                0156                                                                                                                   Interactive Mode                0157                                          Line number       7     Editor line number from source fil               Interactive Mode                0158                                                                                                                   Interactive Mode                0159                                          Type              1     Type of statement or data value,                 Interactive Mode                0160                                                                  using the following hex values:                  Interactive Mode                0161                                                                                                                   Interactive Mode                0162                                                                  F0    FORMAT statement                           Interactive Mode                0163                                                                  E0    Executable statement                       Interactive Mode                0164                                                                                                                   Interactive Mode                0165                                                                  All other variable types are bit-                Interactive Mode                0166                                                                  coded:                                           Interactive Mode                0167                                                                  01    String                                     Interactive Mode                0168                                                                  02    Variable, not constant                     Interactive Mode                0169                                                                  04    LOCAL                                      Interactive Mode                0170                                                                  08    COMMON                                     Interactive Mode                0171                                                                  0C    Constant (can't be both loca               Interactive Mode                0172                                                                        and $COM)                                  Interactive Mode                0173                                                                  20    Array                                      Interactive Mode                0174                                                                                                                   Interactive Mode                0175                                          Precision         1     Field precision. Ignore if non-                  Interactive Mode                0176                                                                  numeric.                                         Interactive Mode                0177                                                                                                                   Interactive Mode                0178                                          Length            1     Field length. Ignore if statement                Interactive Mode                0179                                                                  label, otherwise string length                   Interactive Mode                0180                                                                  (including length byte) or numeric               Interactive Mode                0181                                                                  length.                                          Interactive Mode                0182                                                                                                                   Interactive Mode                0183                                          *  The sort control field will force statement label                     Interactive Mode                0184                                          definitions to the top. This means that the first line                   Interactive Mode                0185                                          number will appear out of order if the statement label is                Interactive Mode                0186                                          referenced in the program before it is defined.                          Interactive Mode                0187                                                                                                                   Interactive Mode                0188                                 2        Compile for execution under Comet 502                                    Interactive Mode                0189                                                                                                                   Interactive Mode                0190                                          Some array element addressing procedures of programs                     Interactive Mode                0191                                          compiled under Comet Version 503 and above will not                      Interactive Mode                0192                                          execute correctly if run under version 502. In order to                  Interactive Mode                0193                                          bypass this problem, the "2" option should be used when                  Interactive Mode                0194                                          compiling programs under 503 which are intended to run                   Interactive Mode                0195                                          under 502.                                                               Interactive Mode                0196                                                                                                                   Interactive Mode                0197                              Compiler options file (#MTB)                                                         Interactive Mode                0198                                                                                                                   Interactive Mode                0199                                 You can create a file called "#MTB" (any data file type) and put                  Interactive Mode                0200                                 in overriding options for the compiler. For example, if you want                  Interactive Mode                0201                                 to byte-align COMMON and get an errors-only listing for all of                    Interactive Mode                0202                                 your compilations, the first record in the "#MTB" file should                     Interactive Mode                0203                                 contain the letters "BE".                                                         Interactive Mode                0204                                                                                                                   Interactive Mode                0205                                 If you are using an MTB command file for your compilation, the                    Interactive Mode                0206                                 compiler recognizes and combines the options (E,S,O,B,A,X,2) from                 Interactive Mode                0207                                 your "#MTB" file with those specified in the list command (!L) of                 Interactive Mode                0208                                 your command file.                                                                Interactive Mode                0209                                                                                                                   Interactive Mode                0210                                 If you are using the interactive mode, the options contained in                   Interactive Mode                0211                                 "#MTB" will be displayed in the "Options" field.                                  Introduction to MoreThanBasic   0001                              Introduction to MoreThanBasic                                                        Introduction to MoreThanBasic   0002                              =============================                                                        Introduction to MoreThanBasic   0003                                                                                                                   Introduction to MoreThanBasic   0004                                 <Language Structure,#HELPMT2>                                                     Introduction to MoreThanBasic   0005                                    <Data Division,#HELPMT3>                                                       Introduction to MoreThanBasic   0006                                    <I/O Format Division,#HELPMT3>                                                 Introduction to MoreThanBasic   0007                                    <Procedure Division,#HELPMT4>                                                  Introduction to MoreThanBasic   0008                                 <Overview of the Comet File System,#HELPMT2>                                      Introduction to MoreThanBasic   0009                                 <Using the MTB Compiler,#HELPMT2>                                                 Introduction to MoreThanBasic   0010                                 <MTB Applications,#HELPMT5>                                                       Introduction to MoreThanBasic   0011                                 <Instant Reference Guide,#HELPMT6>                                                Introduction to MoreThanBasic   0012                                 <Index|INDEX,#HELPMTB>                                                            Introduction to MoreThanBasic   0013                                                                                                                   Introduction to MoreThanBasic   0014                                 MoreThanBasic is a business programming language designed for the                 Introduction to MoreThanBasic   0015                                 Comet operating environment. MoreThanBasic (MTB) offers much more                 Introduction to MoreThanBasic   0016                                 than other versions of BASIC, including:                                          Introduction to MoreThanBasic   0017                                                                                                                   Introduction to MoreThanBasic   0018                                 *  powerful input/output statements                                               Introduction to MoreThanBasic   0019                                 *  screen formatting commands for block input/output                              Introduction to MoreThanBasic   0020                                 *  numeric values up to 16 digits, with up to 15 decimal place                    Introduction to MoreThanBasic   0021                                    accuracy                                                                       Introduction to MoreThanBasic   0022                                 *  record locking and file locking capabilities                                   Introduction to MoreThanBasic   0023                                 *  uncomplicated commands for trapping and handling runtime                       Introduction to MoreThanBasic   0024                                    exceptions                                                                     Introduction to MoreThanBasic   0025                                 *  a full complement of string and numeric functions                              Introduction to MoreThanBasic   0026                                 *  advanced subroutine and subprogram features                                    Introduction to MoreThanBasic   0027                                 *  alphanumeric statement labels                                                  Introduction to MoreThanBasic   0028                                 *  direct access to low-level DOS functions                                       Introduction to MoreThanBasic   0029                                                                                                                   Introduction to MoreThanBasic   0030                                 MTB is a compiler language. A good portion of the object code                     Introduction to MoreThanBasic   0031                                 created by the MTB compiler results in calls to Comet's                           Introduction to MoreThanBasic   0032                                 dynamically shared runtime library. This means smaller, more                      Introduction to MoreThanBasic   0033                                 efficient object code. This also means that Comet's advanced file                 Introduction to MoreThanBasic   0034                                 management and formatting capabilities are available to all MTB                   Introduction to MoreThanBasic   0035                                 programs.                                                                         Introduction to MoreThanBasic   0036                                                                                                                   Introduction to MoreThanBasic   0037                                 Many versions of the BASIC language are interpreter languages,                    Introduction to MoreThanBasic   0038                                 where the source code is translated to machine code each time the                 Introduction to MoreThanBasic   0039                                 program is run. While this can be useful for teaching beginning                   Introduction to MoreThanBasic   0040                                 programming skills, it is much less efficient in repeated use                     Introduction to MoreThanBasic   0041                                 than a compiler language that creates an object program one time                  Introduction to MoreThanBasic   0042                                 only. MTB was designed with efficiency in mind, and was therefore                 Introduction to MoreThanBasic   0043                                 designed as a compiler language.                                                  Introduction to MoreThanBasic   0044                                                                                                                   Introduction to MoreThanBasic   0045                                 MTB source programs are divided into three sections:                              Introduction to MoreThanBasic   0046                                                                                                                   Introduction to MoreThanBasic   0047                                 <Data Division,#HELPMT3>                                                          Introduction to MoreThanBasic   0048                                                                                                                   Introduction to MoreThanBasic   0049                                    Statements in this division define the data variables to be                    Introduction to MoreThanBasic   0050                                    used in the program, including specifications for data type,                   Introduction to MoreThanBasic   0051                                    size, and other attributes. One exceptional feature is MTB's                   Introduction to MoreThanBasic   0052                                    ability to declare data as "common" to be used in multiple                     Introduction to MoreThanBasic   0053                                    program overlays.                                                              Introduction to MoreThanBasic   0054                                                                                                                   Introduction to MoreThanBasic   0055                                 <I/O Format Division,#HELPMT3>                                                    Introduction to MoreThanBasic   0056                                                                                                                   Introduction to MoreThanBasic   0057                                    The division includes statements, control codes, and data                      Introduction to MoreThanBasic   0058                                    definitions for all input/output formatting. There are                         Introduction to MoreThanBasic   0059                                    numerous controls for video terminal formatting, featuring                     Introduction to MoreThanBasic   0060                                    block input of multiple data fields and in-terminal editing of                 Introduction to MoreThanBasic   0061                                    data. Likewise, there are many control codes for printers and                  Introduction to MoreThanBasic   0062                                    other I/O devices.                                                             Introduction to MoreThanBasic   0063                                                                                                                   Introduction to MoreThanBasic   0064                                 <Procedure Division,#HELPMT4>                                                     Introduction to MoreThanBasic   0065                                                                                                                   Introduction to MoreThanBasic   0066                                    The Procedure Division includes statements using familiar                      Introduction to MoreThanBasic   0067                                    BASIC syntax in most cases, plus a myriad of additional                        Introduction to MoreThanBasic   0068                                    statements designed just for business applications purposes.                   Keyed files                     0001                              Keyed files                                                                          Keyed files                     0002                              ===========                                                                          Keyed files                     0003                                                                                                                   Keyed files                     0004                                 Keyed files provide direct access to the data records.                            Keyed files                     0005                                                                                                                   Keyed files                     0006                                 Comet stores data for keyed files in two DOS disk files. One DOS                  Keyed files                     0007                                 file stores the data records in their entered order, and a "key                   Keyed files                     0008                                 tree" file stores the record keys in ascending ASCII order.                       Keyed files                     0009                                                                                                                   Keyed files                     0010                                 An individual record may be retrieved using this identifier using                 Keyed files                     0011                                 the <KEY=,#HELPMT4> parameter of the <READ,#HELPMT4> (or                          Keyed files                     0012                                 associated input) statement.                                                      Keyed files                     0013                                                                                                                   Keyed files                     0014                                 A keyed file may also be read in key-sequential order; records                    Keyed files                     0015                                 are retrieved in ascending sorted key order.                                      Keyed files                     0016                                                                                                                   Keyed files                     0017                                 The index for a keyed file is a string field from 1 to 64                         Keyed files                     0018                                 characters long. When the file is created, the key length is                      Keyed files                     0019                                 specified. So is the record length; this value ranges from 1 to                   Keyed files                     0020                                 1,024 bytes, and is fixed for each record in the file. Because of                 Keyed files                     0021                                 the ease of use and advantages of direct access, keyed files are                  Keyed files                     0022                                 the most common type of data files used in MTB applications.                      Keyed files                     0023                                                                                                                   Keyed files                     0024                                 When an MTB program opens a keyed file, the Comet operating                       Keyed files                     0025                                 system assigns a unique file pointer to the file. Each user                       Keyed files                     0026                                 opening the file is assigned a unique pointer, allowing multiple                  Keyed files                     0027                                 users to access data from the same file at the same time. To                      Keyed files                     0028                                 avoid data integrity problems when more than one user is                          Keyed files                     0029                                 accessing a file, MTB provides a record locking mechanism. The                    Keyed files                     0030                                 <EXTRACT,#HELPMT4> statement is used to read and lock individual                  Keyed files                     0031                                 data records.                                                                     Keyed files                     0032                                                                                                                   Keyed files                     0033                                 As a user accesses records in a keyed file, the file pointer                      Keyed files                     0034                                 keeps track of the current location. When the file is opened, the                 Keyed files                     0035                                 pointer is located at the record associated with the first key.                   Keyed files                     0036                                 If the records are retrieved without an index, the pointer moves                  Keyed files                     0037                                 along in ascending ASCII order of the key values (i.e., in key-                   Keyed files                     0038                                 sequential order).                                                                Keyed files                     0039                                                                                                                   Keyed files                     0040                                 When a record is accessed directly using an index, the pointer is                 Keyed files                     0041                                 moved to the associated position. If no record is found matching                  Keyed files                     0042                                 the specified index, an exception occurs, but the pointer is                      Keyed files                     0043                                 located at the index following the requested index value. From                    Keyed files                     0044                                 this point, the program could retrieve records in sequence                        Keyed files                     0045                                 (without an index), or retrieve another record from the file                      Keyed files                     0046                                 using another index value.                                                        Keyed files                     0047                                                                                                                   Keyed files                     0048                                 Keyed files may also be accessed with a numeric index. In this                    Keyed files                     0049                                 case, the index value is used to specify the record number in the                 Keyed files                     0050                                 file in record number sequence (rather than in key sequence).                     Keyed files                     0051                                 Note: This access method may produce records that have been                       Keyed files                     0052                                 marked for deletion. These records will contain a hex "FE" in the                 Keyed files                     0053                                 seventh byte of the record.                                                       Keyed files                     0054                                                                                                                   Keyed files                     0055                                 Application notes:                                                                Keyed files                     0056                                                                                                                   Keyed files                     0057                                 1. A keyed file provides the most convenient way to randomly                      Keyed files                     0058                                    access a file. Therefore, most MTB programs use keyed files to                 Keyed files                     0059                                    store data records.                                                            Keyed files                     0060                                                                                                                   Keyed files                     0061                                 2. When a record is deleted from a keyed file, the record space                   Keyed files                     0062                                    is reused by the file to store subsequent records. This                        Keyed files                     0063                                    advantage is another reason why keyed files are predominant in                 Keyed files                     0064                                    MTB applications.                                                              Keyed files                     0065                                                                                                                   Keyed files                     0066                                 3. A special type of keyed file can be used to create secondary                   Keyed files                     0067                                    indexes for any keyed file. A key-only file is a keyed file                    Keyed files                     0068                                    with a record size of zero bytes and a specified key size from                 Keyed files                     0069                                    1 to 64 bytes. Typically, a key-only file would contain a                      Keyed files                     0070                                    composite key value made up of two or more fields from a                       Keyed files                     0071                                    related keyed file.                                                            Keyed files                     0072                                                                                                                   Keyed files                     0073                                    For example, suppose a keyed file contains customer names and                  Keyed files                     0074                                    addresses. Typically, this file would be keyed by customer                     Keyed files                     0075                                    number. A secondary key could be created for this file and                     Keyed files                     0076                                    saved in a separate key-only file. The secondary key could be                  Keyed files                     0077                                    composed of customer name and customer number (concatenated                    Keyed files                     0078                                    into a single key value). Thus, with the appropriate                           Keyed files                     0079                                    programming, an application could access the customer file via                 Keyed files                     0080                                    either the primary key (customer number) or the secondary key                  Keyed files                     0081                                    (customer name).                                                               Keyed files                     0082                                                                                                                   Keyed files                     0083                                    The contents of key-only files are maintained by application                   Keyed files                     0084                                    programs, not by Comet. Likewise, lookup routines must be                      Keyed files                     0085                                    provided by the application program. Nonetheless, key-only                     Keyed files                     0086                                    files are popular tools in MTB applications.                                   Keyed files                     0087                                                                                                                   Keyed files                     0088                                 Also see <Record Types>.                                                          Language Structure              0001                              Language Structure                                                                   Language Structure              0002                              ==================                                                                   Language Structure              0003                                                                                                                   Language Structure              0004                                 <Source Program Divisions>                                                        Language Structure              0005                                 <Notation Conventions>                                                            Language Structure              0006                                 <Creating MTB Source Programs>                                                    Language Structure              0007                                 <Line Numbers vs. Labels>                                                         Language Structure              0008                                 <Multiple Statements on a Line>                                                   Language Structure              0009                                 <Statement Continuation>                                                          Language Structure              0010                                 <Indentation>                                                                     Language Structure              0011                                 <Comment Character>                                                               Language Structure              0012                                 <Special Characters,#HELPMT6>                                                     Language Structure              0013                                 <Data Types>                                                                      Language Structure              0014                                 <Operations>                                                                      Language Structure              0015                                 <Usefiles>                                                                        Language Structure              0016                                 <Subprograms>                                                                     Line Numbers vs. Labels         0001                              Line Numbers vs. Labels                                                              Line Numbers vs. Labels         0002                              =======================                                                              Line Numbers vs. Labels         0003                                                                                                                   Line Numbers vs. Labels         0004                                 Editor line numbers are not statement labels.                                     Line Numbers vs. Labels         0005                                                                                                                   Line Numbers vs. Labels         0006                                 The CED utility program employs line numbers to maintain the                      Line Numbers vs. Labels         0007                                 sequence of lines in a source program. Line numbers range from 1                  Line Numbers vs. Labels         0008                                 to 9999999. Line numbers are not part of the MTB source statement                 Line Numbers vs. Labels         0009                                 itself and are not referenced from within the program.                            Line Numbers vs. Labels         0010                                                                                                                   Line Numbers vs. Labels         0011                                 However, some MTB statements employ statement labels that are a                   Line Numbers vs. Labels         0012                                 part of the MTB source statement.                                                 Line Numbers vs. Labels         0013                                                                                                                   Line Numbers vs. Labels         0014                                 a. Labels for I/O Format statements are called "format statement                  Line Numbers vs. Labels         0015                                    labels."                                                                       Line Numbers vs. Labels         0016                                                                                                                   Line Numbers vs. Labels         0017                                 b. Labels for Procedure Division statements are called "statement                 Line Numbers vs. Labels         0018                                    labels."                                                                       Line Numbers vs. Labels         0019                                                                                                                   Line Numbers vs. Labels         0020                                 Format labels are required for every I/O Format statement, while                  Line Numbers vs. Labels         0021                                 statement labels in the Procedure Division are used only for                      Line Numbers vs. Labels         0022                                 statements that are logical branch points in the program (e.g.,                   Line Numbers vs. Labels         0023                                 subroutines, exception routines, branch-to routines).                             Line Numbers vs. Labels         0024                                                                                                                   Line Numbers vs. Labels         0025                                 The MTB compiler views format labels and statement labels in two                  Line Numbers vs. Labels         0026                                 distinct groups. Therefore, it is possible to use the same label                  Line Numbers vs. Labels         0027                                 in both the I/O Format Division and the Procedure Division.                       Line Numbers vs. Labels         0028                                                                                                                   Line Numbers vs. Labels         0029                                 Labels may be numeric or alphanumeric.                                            Line Numbers vs. Labels         0030                                                                                                                   Line Numbers vs. Labels         0031                                 a. Numeric labels                                                                 Line Numbers vs. Labels         0032                                                                                                                   Line Numbers vs. Labels         0033                                    Numeric labels may contain up to four digits (e.g., 1, 10,                     Line Numbers vs. Labels         0034                                    100, 1000). The MTB compiler treats numeric labels as a string                 Line Numbers vs. Labels         0035                                    of characters, rather than as a numeric value. This means that                 Line Numbers vs. Labels         0036                                    labels such as 1, 01, 001, and 0001 are all different from                     Line Numbers vs. Labels         0037                                    each other.                                                                    Line Numbers vs. Labels         0038                                                                                                                   Line Numbers vs. Labels         0039                                 b. Alphanumeric labels                                                            Line Numbers vs. Labels         0040                                                                                                                   Line Numbers vs. Labels         0041                                    Alphanumeric labels may be any length, but the first eight                     Line Numbers vs. Labels         0042                                    characters must be unique within a single source program.                      Line Numbers vs. Labels         0043                                    Alphanumeric labels must begin with a letter and end with a                    Line Numbers vs. Labels         0044                                    colon (:) when being defined (other references do not include                  Line Numbers vs. Labels         0045                                    the colon). Characters following the first one may be                          Line Numbers vs. Labels         0046                                    alphabetic or numeric. No special symbols or blanks are                        Line Numbers vs. Labels         0047                                    allowed in statement labels.                                                   Line Numbers vs. Labels         0048                                                                                                                   Line Numbers vs. Labels         0049                              Example 1:                                                                           Line Numbers vs. Labels         0050                                                                                                                   Line Numbers vs. Labels         0051                                 Line                                                                              Line Numbers vs. Labels         0052                                 number   Label       Statement                                                    Line Numbers vs. Labels         0053                                 =================================================================                 Line Numbers vs. Labels         0054                                 100      SCREEN:     FORMAT "THIS IS AN I/O FORMAT STATEMENT."                    Line Numbers vs. Labels         0055                                 200      .                                                                        Line Numbers vs. Labels         0056                                 300      .                                                                        Line Numbers vs. Labels         0057                                 400      .                                                                        Line Numbers vs. Labels         0058                                 500      START:      PRINT (0,SCREEN)                                             Line Numbers vs. Labels         0059                                 600      .                                                                        Line Numbers vs. Labels         0060                                 700      .                                                                        Line Numbers vs. Labels         0061                                 800      .                                                                        Line Numbers vs. Labels         0062                                 900                  GOTO START                                                   Line Numbers vs. Labels         0063                                                                                                                   Line Numbers vs. Labels         0064                                 In this example, the editor line numbers start at 100 and end at                  Line Numbers vs. Labels         0065                                 900. Line 100 has a label of SCREEN. Since this statement is an                   Line Numbers vs. Labels         0066                                 I/O Format statement, the label is a format label. Line 500 is an                 Line Numbers vs. Labels         0067                                 executable statement, labelled START, which is a statement label.                 Line Numbers vs. Labels         0068                                 Note that it refers to the format label used earlier in the                       Line Numbers vs. Labels         0069                                 program. The last statement shown is also an executable                           Line Numbers vs. Labels         0070                                 statement; it refers to the statement label used in the second                    Line Numbers vs. Labels         0071                                 statement shown.                                                                  Line Numbers vs. Labels         0072                                                                                                                   Line Numbers vs. Labels         0073                              Example 2:                                                                           Line Numbers vs. Labels         0074                                                                                                                   Line Numbers vs. Labels         0075                                 Line                                                                              Line Numbers vs. Labels         0076                                 number   Label       Statement                                                    Line Numbers vs. Labels         0077                                 =================================================================                 Line Numbers vs. Labels         0078                                 100      TOP:        PRINT (0) (EN);(CS)                                          Line Numbers vs. Labels         0079                                 200      .                                                                        Line Numbers vs. Labels         0080                                 300      .                                                                        Line Numbers vs. Labels         0081                                 400      LOOP:                                                                    Line Numbers vs. Labels         0082                                 500                  READ (1,CUSTFILE) EXCP=8000                                  Line Numbers vs. Labels         0083                                 600                  PRINT (2,PRINTER) EXCP=9000                                  Line Numbers vs. Labels         0084                                 700      .                                                                        Line Numbers vs. Labels         0085                                 800      .                                                                        Line Numbers vs. Labels         0086                                 900                  GOTO LOOP                                                    Line Numbers vs. Labels         0087                                                                                                                   Line Numbers vs. Labels         0088                                 This example demonstrates two approaches to using statement                       Line Numbers vs. Labels         0089                                 labels. On editor line number 100, the label TOP: appears on the                  Line Numbers vs. Labels         0090                                 same line as an MTB statement. However, on editor line number                     Line Numbers vs. Labels         0091                                 400, the label LOOP: appears by itself (without an MTB statement                  Line Numbers vs. Labels         0092                                 on the same line). Both methods are valid.                                        Logical Operations              0001                              Logical Operations                                                                   Logical Operations              0002                              ==================                                                                   Logical Operations              0003                                                                                                                   Logical Operations              0004                                 The MTB language supports the AND and OR logical operations to be                 Logical Operations              0005                                 used in conjunction with relational expressions. The AND operator                 Logical Operations              0006                                 tests whether both relational conditions are true, while the OR                   Logical Operations              0007                                 operator tests for truth of either relational condition. For                      Logical Operations              0008                                 example:                                                                          Logical Operations              0009                                                                                                                   Logical Operations              0010                                    IF A=B AND B=C THEN...        !  Both conditions must be true                  Logical Operations              0011                                                                                                                   Logical Operations              0012                                    IF A=B OR B=C THEN...         !  Either condition may be true                  Logical Operations              0013                                                                                                                   Logical Operations              0014                                 If AND and OR are combined in a relational expression, the AND                    Logical Operations              0015                                 operator takes precedence (i.e., it will be evaluated first). It                  Logical Operations              0016                                 is possible to override this precedence with parentheses, just                    Logical Operations              0017                                 like the precedence in numeric operations can be overridden.                      Logical Operations              0018                                                                                                                   Logical Operations              0019                                 For more information on relational operations and logical                         Logical Operations              0020                                 operations, see the <IF,#HELPMT4> statement.                                      Modulo                          0001                              Modulo                                                                               Modulo                          0002                              ======                                                                               Modulo                          0003                                                                                                                   Modulo                          0004                                 The MOD operator performs a modulo operation on the two numeric                   Modulo                          0005                                 values (i.e., it divides the first value by the second value and                  Modulo                          0006                                 returns the remainder).                                                           Modulo                          0007                                                                                                                   Modulo                          0008                                 The MOD operator is supported in Comet 504 and greater.                           Modulo                          0009                                                                                                                   Modulo                          0010                              The syntax is:                                                                       Modulo                          0011                                                                                                                   Modulo                          0012                                 numeric-value-1 MOD numeric-value-2                                               Modulo                          0013                                                                                                                   Modulo                          0014                              Example:                                                                             Modulo                          0015                                                                                                                   Modulo                          0016                                 10 MOD 3                                                                          Modulo                          0017                                                                                                                   Modulo                          0018                                 This operation returns a value of 1. Explanation: 10 divided by 3                 Modulo                          0019                                 equals 3 with a remainder of 1.                                                   Multiple Statements on a Line   0001                              Multiple Statements on a Line                                                        Multiple Statements on a Line   0002                              =============================                                                        Multiple Statements on a Line   0003                                                                                                                   Multiple Statements on a Line   0004                                 One of the many convenient programming features of MTB is the                     Multiple Statements on a Line   0005                                 ability to write more than one source statement on the same                       Multiple Statements on a Line   0006                                 editor line. A special character is required for this purpose;                    Multiple Statements on a Line   0007                                 the character is the ampersand (&).                                               Multiple Statements on a Line   0008                                                                                                                   Multiple Statements on a Line   0009                                 When used on a source program line, the ampersand permits                         Multiple Statements on a Line   0010                                 multiple statements to be written on a single line. There is no                   Multiple Statements on a Line   0011                                 limit to the number of statements that can appear on one source                   Multiple Statements on a Line   0012                                 line (other than the editor's line length limitation).                            Multiple Statements on a Line   0013                                                                                                                   Multiple Statements on a Line   0014                                 Note: The ampersand character can be used in all divisions of an                  Multiple Statements on a Line   0015                                 MTB source program.                                                               Multiple Statements on a Line   0016                                                                                                                   Multiple Statements on a Line   0017                                 Also see <Underscore and ampersand>.                                              Multiple Statements on a Line   0018                                                                                                                   Multiple Statements on a Line   0019                              Example 1:                                                                           Multiple Statements on a Line   0020                                                                                                                   Multiple Statements on a Line   0021                                 LET A=10 & LET B=20 & LET C=30                                                    Multiple Statements on a Line   0022                                                                                                                   Multiple Statements on a Line   0023                                 This example shows how three assignment statements can be written                 Multiple Statements on a Line   0024                                 on a single source line.                                                          Multiple Statements on a Line   0025                                                                                                                   Multiple Statements on a Line   0026                              Example 2:                                                                           Multiple Statements on a Line   0027                                                                                                                   Multiple Statements on a Line   0028                                 LENGTH 8.2 & LOCAL CRLIMIT                                                        Multiple Statements on a Line   0029                                                                                                                   Multiple Statements on a Line   0030                                 This example shows how two Data Division statements (LENGTH and                   Multiple Statements on a Line   0031                                 LOCAL) can be written on a single source line.                                    Multiple Statements on a Line   0032                                                                                                                   Multiple Statements on a Line   0033                              Example 3:                                                                           Multiple Statements on a Line   0034                                                                                                                   Multiple Statements on a Line   0035                                 IF ARTOTAL GT CREDIT THEN PRINT (0) "OVER THE LIMIT" & GOTO 1000                  Multiple Statements on a Line   0036                                                                                                                   Multiple Statements on a Line   0037                                 This example shows how multiple statements (PRINT and GOTO) can                   Multiple Statements on a Line   0038                                 be written after the THEN clause of an IF statement.                              Multiplication                  0001                              Multiplication                                                                       Multiplication                  0002                              ==============                                                                       Multiplication                  0003                                                                                                                   Multiplication                  0004                                 The asterisk (*) is the operator used to perform multiplication                   Multiplication                  0005                                 on numeric data.                                                                  Multiplication                  0006                                                                                                                   Multiplication                  0007                                 Notes:                                                                            Multiplication                  0008                                                                                                                   Multiplication                  0009                                 1. If the result of a multiplication operation exceeds the                        Multiplication                  0010                                    defined length of a receiving numeric variable, the value will                 Multiplication                  0011                                    be truncated on the left-hand side without warning.                            Multiplication                  0012                                                                                                                   Multiplication                  0013                                 2. If the precision of the result exceeds the defined precision                   Multiplication                  0014                                    of a receiving variable (and the variable has not been defined                 Multiplication                  0015                                    for automatic rounding), the result will be truncated on the                   Multiplication                  0016                                    right-hand side. See the <ROUND,#HELPMT3> statement for more                   Multiplication                  0017                                    information.                                                                   Multiplication                  0018                                                                                                                   Multiplication                  0019                                 Also see <the LET statement|LET,#HELPMT4>.                                        Multiplication                  0020                                                                                                                   Multiplication                  0021                              Example:                                                                             Multiplication                  0022                                                                                                                   Multiplication                  0023                                 LENGTH 5.0                 ! Declare the length for A, B, C                       Multiplication                  0024                                 LOCAL A, B, C              ! Declare them as LOCAL variables                      Multiplication                  0025                                 .                                                                                 Multiplication                  0026                                 LET A = 150                ! Set the value for A                                  Multiplication                  0027                                 LET B = 25                 ! Set the value for B                                  Multiplication                  0028                                 LET C = A * B              ! Multiply A and B, giving C                           Notation Conventions            0001                              Notation Conventions                                                                 Notation Conventions            0002                              ====================                                                                 Notation Conventions            0003                                                                                                                   Notation Conventions            0004                                 In general, MTB statements consist of a keyword, one or more                      Notation Conventions            0005                                 required parameters, and one or more optional parameters. The                     Notation Conventions            0006                                 basic format of an MTB statement is:                                              Notation Conventions            0007                                                                                                                   Notation Conventions            0008                                    KEYWORD required-parameter [optional-parameter]                                Notation Conventions            0009                                                                                                                   Notation Conventions            0010                                 In this documentation, MTB reserved words are printed entirely in                 Notation Conventions            0011                                 CAPITAL LETTERS. When used in a source program, reserved words                    Notation Conventions            0012                                 may be entered in upper or lower case.                                            Notation Conventions            0013                                                                                                                   Notation Conventions            0014                                 For example:                                                                      Notation Conventions            0015                                                                                                                   Notation Conventions            0016                                    PRINT (0) "CUSTOMER MASTER REPORT"                                             Notation Conventions            0017                                    Print (0) "CUSTOMER MASTER REPORT"                                             Notation Conventions            0018                                    print (0) "CUSTOMER MASTER REPORT"                                             Notation Conventions            0019                                                                                                                   Notation Conventions            0020                                 If a keyword is misspelled in a source program, it will not be                    Notation Conventions            0021                                 recognized by the MTB compiler as a reserved word. This may                       Notation Conventions            0022                                 result in one or more errors when the program is compiled.                        Notation Conventions            0023                                                                                                                   Notation Conventions            0024                                 Keywords are required in all cases where listed. Some keywords                    Notation Conventions            0025                                 are optional (e.g., the word LET in an assignment statement, for                  Notation Conventions            0026                                 example. In this documentation, optional keywords are enclosed in                 Notation Conventions            0027                                 square brackets ([]).                                                             Notation Conventions            0028                                                                                                                   Notation Conventions            0029                                 Square brackets are also used to indicate optional parameters in                  Notation Conventions            0030                                 MTB statements. For example, one of the most frequently used                      Notation Conventions            0031                                 parameters is the EXCP=statement-label parameter. This is used                    Notation Conventions            0032                                 for the automatic handling of runtime exception conditions, but                   Notation Conventions            0033                                 is an optional feature in all cases. Therefore, when the                          Notation Conventions            0034                                 statement syntax is shown, this parameter appears inside of                       Notation Conventions            0035                                 square brackets, as follows:                                                      Notation Conventions            0036                                                                                                                   Notation Conventions            0037                                    KEYWORD required-parameter [EXCP=statement-label]                              Notation Conventions            0038                                                                                                                   Notation Conventions            0039                                 In the statement syntax sections of this documentation, words                     Notation Conventions            0040                                 printed in lower case represent parameters to be supplied by the                  Notation Conventions            0041                                 programmer. All such words are defined in the text of this                        Notation Conventions            0042                                 documentation. For example, the COMMON statement (covered in the                  Notation Conventions            0043                                 Data Division section) requires a list of variables. This list is                 Notation Conventions            0044                                 a required parameter of the statement, and is shown:                              Notation Conventions            0045                                                                                                                   Notation Conventions            0046                                    COMMON variable-list                                                           Notation Conventions            0047                                                                                                                   Notation Conventions            0048                                 Certain parameters can be repeated multiple times. The notation                   Notation Conventions            0049                                 for this is ellipses (...).                                                       Notation Conventions            0050                                                                                                                   Notation Conventions            0051                                 All source statement punctuation and other special characters are                 Notation Conventions            0052                                 required when they are shown. If they are omitted, errors will                    Notation Conventions            0053                                 occur when the program is compiled.                                               Notation Conventions            0054                                                                                                                   Notation Conventions            0055                                 Commas are required as delimiters in arrays, but they are                         Notation Conventions            0056                                 optional in all other statements.                                                 Notation Conventions            0057                                                                                                                   Notation Conventions            0058                                 Indentation of source statements is not required, but usually                     Notation Conventions            0059                                 helps to define the structure of the code.                                        Numeric Operations              0001                              Numeric Operations                                                                   Numeric Operations              0002                              ==================                                                                   Numeric Operations              0003                                                                                                                   Numeric Operations              0004                                 The following types of operations may be performed on numeric                     Numeric Operations              0005                                 data:                                                                             Numeric Operations              0006                                                                                                                   Numeric Operations              0007                                 *  <Addition>                                                                     Numeric Operations              0008                                 *  <Subtraction>                                                                  Numeric Operations              0009                                 *  <Multiplication>                                                               Numeric Operations              0010                                 *  <Division>                                                                     Numeric Operations              0011                                 *  <Modulo>                                                                       Numeric Operations              0012                                                                                                                   Numeric Operations              0013                                 Also see the notes about <Precedence>.                                            Operations                      0001                              Operations                                                                           Operations                      0002                              ==========                                                                           Operations                      0003                                                                                                                   Operations                      0004                                 The MTB language supports the following types of operations:                      Operations                      0005                                                                                                                   Operations                      0006                                 *  <Numeric Operations>                                                           Operations                      0007                                 *  <String Operations>                                                            Operations                      0008                                 *  <Relational Operations>                                                        Operations                      0009                                 *  <Logical Operations>                                                           Operations                      0010                                                                                                                   Operations                      0011                                 In addition to these operations, there are may functions that                     Operations                      0012                                 operate on string and/or numeric data. For more information, see                  Operations                      0013                                 the <Procedure Division,#HELPMT4> documentation.                                  Overview of the Comet File Syste0001                              Overview of the Comet File System                                                    Overview of the Comet File Syste0002                              =================================                                                    Overview of the Comet File Syste0003                                                                                                                   Overview of the Comet File Syste0004                                 Comet supports three types of data files:                                         Overview of the Comet File Syste0005                                                                                                                   Overview of the Comet File Syste0006                                 *  <Keyed files>                                                                  Overview of the Comet File Syste0007                                 *  <Indexed Sequential files>                                                     Overview of the Comet File Syste0008                                 *  <Text files>                                                                   Overview of the Comet File Syste0009                                                                                                                   Overview of the Comet File Syste0010                                 These are documented herein from an applications programming                      Overview of the Comet File Syste0011                                 perspective, rather than an operating system perspective. For an                  Overview of the Comet File Syste0012                                 operating system view of Comet data files, please refer to the                    Overview of the Comet File Syste0013                                 Comet System Description manual.                                                  Overview of the Comet File Syste0014                                                                                                                   Overview of the Comet File Syste0015                                 Also see <Record Types> and <File I/O Operations>.                                Precedence                      0001                              Precedence                                                                           Precedence                      0002                              ==========                                                                           Precedence                      0003                                                                                                                   Precedence                      0004                                 In a numeric expression containing multiple operations, the                       Precedence                      0005                                 multiplication and division operations are performed first (from                  Precedence                      0006                                 left to right). Next, the addition and subtraction operations are                 Precedence                      0007                                 performed (also from left to right).                                              Precedence                      0008                                                                                                                   Precedence                      0009                                 This algebraic order can be overridden with parentheses. In a                     Precedence                      0010                                 numeric expression containing parentheses, operations inside the                  Precedence                      0011                                 parentheses will be performed first, followed by the algebraic                    Precedence                      0012                                 order previously described. Parentheses may be nested to any                      Precedence                      0013                                 level in a numeric expression -- they will be performed from the                  Precedence                      0014                                 inside to the outside.                                                            Precedence                      0015                                                                                                                   Precedence                      0016                                 Results                                                                           Precedence                      0017                                 =======                                                                           Precedence                      0018                                                                                                                   Precedence                      0019                                 The temporary result of a numeric operation will contain only as                  Precedence                      0020                                 many digits to the right of the decimal point as the most precise                 Precedence                      0021                                 operand in the expression. For example, if an expression contains                 Precedence                      0022                                 operand with two digits of precision and four digits of                           Precedence                      0023                                 precision, the temporary result will contain four digits of                       Precedence                      0024                                 precision.                                                                        Record Types                    0001                              Record Types                                                                         Record Types                    0002                              ============                                                                         Record Types                    0003                                                                                                                   Record Types                    0004                                 All of the data file types supported by the Comet co-operating                    Record Types                    0005                                 system support two different types of records: image and non-                     Record Types                    0006                                 image.                                                                            Record Types                    0007                                                                                                                   Record Types                    0008                                 Non-image                                                                         Record Types                    0009                                 =========                                                                         Record Types                    0010                                                                                                                   Record Types                    0011                                 Non-image records store data fields in the following manner:                      Record Types                    0012                                                                                                                   Record Types                    0013                                 *  String fields are stored using their defined length (from the                  Record Types                    0014                                    Data Division of the program). For example, a string field                     Record Types                    0015                                    called NAME$, defined to store 30 characters, would occupy 30                  Record Types                    0016                                    bytes of disk space in a non-image file. This field would                      Record Types                    0017                                    always take 30 bytes, even if the actual number of characters                  Record Types                    0018                                    in the field were less than 30.                                                Record Types                    0019                                                                                                                   Record Types                    0020                                 *  Numeric fields are also stored using their defined length. In                  Record Types                    0021                                    this case, each digit of the numeric field would require one                   Record Types                    0022                                    byte of disk space in the record. In addition, a byte would be                 Record Types                    0023                                    required for the decimal point, and another byte would be                      Record Types                    0024                                    required for the sign of the numeric field. For example, a                     Record Types                    0025                                    numeric field named CRLIMIT, defined with a length and                         Record Types                    0026                                    precision of 6.0 would take eight bytes in a non-image record                  Record Types                    0027                                    (six for the digits, one for the decimal point, and one for                    Record Types                    0028                                    the sign).                                                                     Record Types                    0029                                                                                                                   Record Types                    0030                                 Image                                                                             Record Types                    0031                                 =====                                                                             Record Types                    0032                                                                                                                   Record Types                    0033                                 Image records store data fields in the following manner:                          Record Types                    0034                                                                                                                   Record Types                    0035                                 *  String fields are stored at the defined length plus one                        Record Types                    0036                                    additional byte. This extra byte is used to store the current                  Record Types                    0037                                    length of the field which may be the full length of the field                  Record Types                    0038                                    or shorter. For example, a string field called NAME$, defined                  Record Types                    0039                                    to store 30 characters, would occupy 31 bytes of disk space in                 Record Types                    0040                                    an image record. This field would always take 31 bytes, even                   Record Types                    0041                                    if the actual number of characters in the field were less than                 Record Types                    0042                                    30.                                                                            Record Types                    0043                                                                                                                   Record Types                    0044                                    Image record storage of strings always takes more space than                   Record Types                    0045                                    non-image records.                                                             Record Types                    0046                                                                                                                   Record Types                    0047                                 *  Numeric fields are stored in packed format, two digits per                     Record Types                    0048                                    byte of disk space. This represents a substantial savings of                   Record Types                    0049                                    disk space. That's why image records are frequently used to                    Record Types                    0050                                    store records containing many numeric fields.                                  Record Types                    0051                                                                                                                   Record Types                    0052                                    Image fields are not stored with a decimal point; it is                        Record Types                    0053                                    implicit when the field is defined in a program. Also, the                     Record Types                    0054                                    sign of a numeric field stored in image format is placed in                    Record Types                    0055                                    the lower half byte of the last byte in the field. A hex value                 Record Types                    0056                                    of 3 in this position indicates a positive number, a 5                         Record Types                    0057                                    indicates a negative number.                                                   Record Types                    0058                                                                                                                   Record Types                    0059                                    To calculate the length of an image field, divide the defined                  Record Types                    0060                                    field length by 2, round off the result (if necessary), and                    Record Types                    0061                                    add 1.                                                                         Record Types                    0062                                                                                                                   Record Types                    0063                                    For example, a numeric field named CRLIMIT, with a defined                     Record Types                    0064                                    length and precision of 6.0, would take four bytes of disk                     Record Types                    0065                                    space in image format.                                                         Relational Operations           0001                              Relational Operations                                                                Relational Operations           0002                              =====================                                                                Relational Operations           0003                                                                                                                   Relational Operations           0004                                 The MTB language supports relational operations in IF/THEN                        Relational Operations           0005                                 statements. The following operations are supported:                               Relational Operations           0006                                                                                                                   Relational Operations           0007                                 Operation                        MTB syntax                                       Relational Operations           0008                                 =================================================================                 Relational Operations           0009                                 Equal to                         EQ  or  =                                        Relational Operations           0010                                 Not equal to                     NE  or  NOT=                                     Relational Operations           0011                                 Greater than                     GT  or  >                                        Relational Operations           0012                                 Greater than or equal to         GE  or  >=                                       Relational Operations           0013                                 Less than                        LT *                                             Relational Operations           0014                                 Less than or equal to            LE *                                             Relational Operations           0015                                                                                                                   Relational Operations           0016                                 * Note: The "less than" symbol and "less than or equal to"                        Relational Operations           0017                                 symbols may also be used as relational operators, however the                     Relational Operations           0018                                 "less than" symbol is a non-display character in this hypertext                   Relational Operations           0019                                 browser and is therefore not shown in the above chart.                            Relational Operations           0020                                                                                                                   Relational Operations           0021                                 Additional information:                                                           Relational Operations           0022                                                                                                                   Relational Operations           0023                                 1. When comparing string values, the ASCII values for the                         Relational Operations           0024                                    characters are compared. For example, upper case "A" is                        Relational Operations           0025                                    considered to be less than lower case "a" because the ASCII                    Relational Operations           0026                                    value for "A" (i.e., 65) is less than the ASCII value for "a"                  Relational Operations           0027                                    (i.e., 97). Thus, it is possible to determine correct                          Relational Operations           0028                                    alphabetical order for strings using relational comparisons.                   Relational Operations           0029                                                                                                                   Relational Operations           0030                                    See the <ASCII chart|ASCII,#HELPMT4>.                                          Relational Operations           0031                                                                                                                   Relational Operations           0032                                 2. Two strings are considered to be equal only when they are                      Relational Operations           0033                                    identical and have the same current length (number of                          Relational Operations           0034                                    characters).                                                                   Source Program Divisions        0001                              Source Program Divisions                                                             Source Program Divisions        0002                              ========================                                                             Source Program Divisions        0003                                                                                                                   Source Program Divisions        0004                                 MTB source programs are arranged into three functional divisions.                 Source Program Divisions        0005                                                                                                                   Source Program Divisions        0006                                 1. <Data Division,#HELPMT3>                                                       Source Program Divisions        0007                                                                                                                   Source Program Divisions        0008                                    The Data Division defines the data variables to be used in the                 Source Program Divisions        0009                                    program.                                                                       Source Program Divisions        0010                                                                                                                   Source Program Divisions        0011                                 2. <I/O Format Division,#HELPMT3>                                                 Source Program Divisions        0012                                                                                                                   Source Program Divisions        0013                                    The I/O Format Division establishes the exact formats and                      Source Program Divisions        0014                                    device control codes for all input/output aspects of the                       Source Program Divisions        0015                                    program.                                                                       Source Program Divisions        0016                                                                                                                   Source Program Divisions        0017                                 3. <Procedure Division,#HELPMT4>                                                  Source Program Divisions        0018                                                                                                                   Source Program Divisions        0019                                    The Procedure Division, contains the executable statements of                  Source Program Divisions        0020                                    the program, including data initialization and assignment,                     Source Program Divisions        0021                                    input and output statements, program flow control, decision                    Source Program Divisions        0022                                    making and looping, and exception handling.                                    Source Program Divisions        0023                                                                                                                   Source Program Divisions        0024                                 In addition to these three functional sections, MTB source                        Source Program Divisions        0025                                 programs may also include statements specifically for the MTB                     Source Program Divisions        0026                                 compiler. These statements include various commands and options                   Source Program Divisions        0027                                 to be used only in the compilation of source programs, statements                 Source Program Divisions        0028                                 that serve no other purpose in the source program. These                          Source Program Divisions        0029                                 compiler-specific commands usually appear at the very beginning                   Source Program Divisions        0030                                 of a source program. <Using the MTB Compiler,#HELPMT2> provides                   Source Program Divisions        0031                                 more information about these commands.                                            Source Program Divisions        0032                                                                                                                   Source Program Divisions        0033                                 So, a typical MTB source program looks like this:                                 Source Program Divisions        0034                                                                                                                   Source Program Divisions        0035                                    Compiler Commands                                                              Source Program Divisions        0036                                    .                                                                              Source Program Divisions        0037                                    .                                                                              Source Program Divisions        0038                                    Data Division                                                                  Source Program Divisions        0039                                    .                                                                              Source Program Divisions        0040                                    .                                                                              Source Program Divisions        0041                                    I/O Format Division                                                            Source Program Divisions        0042                                    .                                                                              Source Program Divisions        0043                                    .                                                                              Source Program Divisions        0044                                    Procedure Division                                                             Source Program Divisions        0045                                    .                                                                              Source Program Divisions        0046                                    .                                                                              Source Program Divisions        0047                                                                                                                   Source Program Divisions        0048                                 Note: Even though the Data Division and I/O Format Division are                   Source Program Divisions        0049                                 shown as separate sections of a source program, they may be                       Source Program Divisions        0050                                 combined and intermixed. That is, format statements may be used                   Source Program Divisions        0051                                 in the Data Division and vice versa. The only requirement is that                 Source Program Divisions        0052                                 data elements used in format statements must be defined prior to                  Source Program Divisions        0053                                 their use. Other than that, it is sometimes more convenient to                    Source Program Divisions        0054                                 think of the Data Division and I/O Format Division as one section                 Source Program Divisions        0055                                 of the source program, rather than two.                                           Statement Continuation          0001                              Statement Continuation                                                               Statement Continuation          0002                              ======================                                                               Statement Continuation          0003                                                                                                                   Statement Continuation          0004                                 Sometimes, MTB source statements can exceed the length of a                       Statement Continuation          0005                                 single editor line. In these cases, the statement may be                          Statement Continuation          0006                                 continued on the following editor line by using an underline                      Statement Continuation          0007                                 character (_) at the end of the first line.                                       Statement Continuation          0008                                                                                                                   Statement Continuation          0009                                 The underline character signals the MTB compiler that the current                 Statement Continuation          0010                                 statement is being continued on the following source line.                        Statement Continuation          0011                                                                                                                   Statement Continuation          0012                                 There is no limit to the number of lines that may be joined using                 Statement Continuation          0013                                 the underline continuation character.                                             Statement Continuation          0014                                                                                                                   Statement Continuation          0015                                 Note: The underline character can be used in all divisions of an                  Statement Continuation          0016                                 MTB source program.                                                               Statement Continuation          0017                                                                                                                   Statement Continuation          0018                                 Note: Any characters following the underline character will be                    Statement Continuation          0019                                 ignored by the MTB compiler. These superfluous characters are                     Statement Continuation          0020                                 treated as remarks and not compiled into the object program.                      Statement Continuation          0021                                                                                                                   Statement Continuation          0022                                 Also see <Underscore and ampersand>.                                              Statement Continuation          0023                                                                                                                   Statement Continuation          0024                              Example:                                                                             Statement Continuation          0025                                                                                                                   Statement Continuation          0026                                 DATA: FORMAT   PARTNUM$;DESC$;_                                                   Statement Continuation          0027                                                QTYHAND;QTYORD;_                                                   Statement Continuation          0028                                                QTYCOMM;_                                                          Statement Continuation          0029                                                AVAIL;LOCATION$;_                                                  Statement Continuation          0030                                                VENDOR$_                                                           Statement Continuation          0031                                                                                                                   Statement Continuation          0032                                 In this example, an I/O Format statement is continued to several                  Statement Continuation          0033                                 source lines (and indented on the secondary lines for readability                 Statement Continuation          0034                                 purposes only).                                                                   String Operations               0001                              String Operations                                                                    String Operations               0002                              =================                                                                    String Operations               0003                                                                                                                   String Operations               0004                                 The MTB language supports the string operation of concatenation.                  String Operations               0005                                 The plus sign (+) is used to indicate concatenation (the                          String Operations               0006                                 combining of strings). For example, concatenating two string                      String Operations               0007                                 variables would look like this:                                                   String Operations               0008                                                                                                                   String Operations               0009                                    FIRSTNAME$ + LASTNAME$                                                         String Operations               0010                                                                                                                   String Operations               0011                                 You may concatenate string constants, string variables, and                       String Operations               0012                                 string functions. Here is an example of concatenating constants                   String Operations               0013                                 with variables:                                                                   String Operations               0014                                                                                                                   String Operations               0015                                    "(" + AREACODE$ + ")" + PHONENUMBER$                                           String Operations               0016                                                                                                                   String Operations               0017                                 Note: The maximum number of characters in any string is 254. If a                 String Operations               0018                                 concatenation operation results in more characters than have been                 String Operations               0019                                 declared for a receiving variable, characters will be truncated                   String Operations               0020                                 on the right-hand side. THIS TRUNCATION WILL OCCUR WITHOUT                        String Operations               0021                                 WARNING OF ANY KIND.                                                              Subprograms                     0001                              Subprograms                                                                          Subprograms                     0002                              ===========                                                                          Subprograms                     0003                                                                                                                   Subprograms                     0004                                 A subprogram is a fully functional object program that can be                     Subprograms                     0005                                 called at any time from any MTB program. Subprograms are written                  Subprograms                     0006                                 in MTB and are completely self-contained.                                         Subprograms                     0007                                                                                                                   Subprograms                     0008                                 Subprograms may or may not use the video windows feature of                       Subprograms                     0009                                 Comet. The Comet Help System uses subprograms to display help                     Subprograms                     0010                                 messages, run lookup programs, or run table lookup programs.                      Subprograms                     0011                                                                                                                   Subprograms                     0012                                 Subprograms are called with the <ENTER,#HELPMT4> statement. When                  Subprograms                     0013                                 an ENTER statement is executed, the partition environment of the                  Subprograms                     0014                                 current program is saved to disk and the subprogram is loaded and                 Subprograms                     0015                                 executed in the same partition.                                                   Subprograms                     0016                                                                                                                   Subprograms                     0017                                 The partition environment is passed in full to the called                         Subprograms                     0018                                 subprogram. This includes the data division (COMMON and LOCAL                     Subprograms                     0019                                 fields) and the open logical unit numbers. If the data division                   Subprograms                     0020                                 of the subprogram is structured exactly the same as the calling                   Subprograms                     0021                                 program, data values are preserved when the subprogram is                         Subprograms                     0022                                 executed. Data values are not preserved, however, when the                        Subprograms                     0023                                 subprogram is concluded.                                                          Subprograms                     0024                                                                                                                   Subprograms                     0025                                 The called subprogram must conclude with an <EXIT,#HELPMT4> or                    Subprograms                     0026                                 <EXITALL,#HELPMT4> statement. When an EXIT statement is executed                  Subprograms                     0027                                 by the subprogram, the partition environment is restored to its                   Subprograms                     0028                                 previous state and the calling program continues executing at the                 Subprograms                     0029                                 next instruction following the ENTER statement. In this regard,                   Subprograms                     0030                                 the ENTER and EXIT statements are very similar to the                             Subprograms                     0031                                 <GOSUB,#HELPMT4> and <RETURN,#HELPMT4> subroutine statements,                     Subprograms                     0032                                 respectively.                                                                     Subprograms                     0033                                                                                                                   Subprograms                     0034                                 When Comet restores the partition environment, it does so using                   Subprograms                     0035                                 the disk file created when the ENTER statement was executed. All                  Subprograms                     0036                                 data values, formats, and instructions are restored to their                      Subprograms                     0037                                 original (pre-subprogram) values. Thus, data is not automatically                 Subprograms                     0038                                 passed back to the calling program (although, refer to the ENTER                  Subprograms                     0039                                 statement documentation for a programming method that passes data                 Subprograms                     0040                                 back to the calling program).                                                     Subprograms                     0041                                                                                                                   Subprograms                     0042                                 Subprograms may be nested up to 99 levels. Each ENTER statement                   Subprograms                     0043                                 calls another level of subprogram, and each EXIT statement                        Subprograms                     0044                                 returns to the previous level. The EXITALL statement returns to                   Subprograms                     0045                                 the original calling program (i.e., the top level).                               Subprograms                     0046                                                                                                                   Subprograms                     0047                              Making hybrid programs                                                               Subprograms                     0048                              ======================                                                               Subprograms                     0049                                                                                                                   Subprograms                     0050                                 A program can be a "program" and "subprogram" at the same time.                   Subprograms                     0051                                                                                                                   Subprograms                     0052                                 By definition, a "program" is one that was started via the                        Subprograms                     0053                                 <RUN,#HELPMT4> statement. A "subprogram," on the other hand, is                   Subprograms                     0054                                 one that was started via the <ENTER,#HELPMT4> statement.                          Subprograms                     0055                                                                                                                   Subprograms                     0056                                 Any given program can determine it's own current status by                        Subprograms                     0057                                 interrogating the system variable named <ENTERLEVEL,#HELPMT3>.                    Subprograms                     0058                                                                                                                   Subprograms                     0059                                 Use the following code to make a hybrid program/subprogram:                       Subprograms                     0060                                                                                                                   Subprograms                     0061                                    IF ENTERLEVEL = 0       ! Was the program RUN?                                 Subprograms                     0062                                       RUN "QMONITOR"       ! Exit to QMONITOR                                     Subprograms                     0063                                    ELSE                    ! Otherwise, the program was ENTERed                   Subprograms                     0064                                       EXIT                 ! Exit to calling program                              Subprograms                     0065                                    ENDIF                                                                          Subtraction                     0001                              Subtraction                                                                          Subtraction                     0002                              ===========                                                                          Subtraction                     0003                                                                                                                   Subtraction                     0004                                 The minus sign (-) is the operator used to perform subtraction on                 Subtraction                     0005                                 numeric data.                                                                     Subtraction                     0006                                                                                                                   Subtraction                     0007                                 Notes:                                                                            Subtraction                     0008                                                                                                                   Subtraction                     0009                                 1. If the result of a subtraction operation exceeds the defined                   Subtraction                     0010                                    length of a receiving numeric variable, the value will be                      Subtraction                     0011                                    truncated on the left-hand side without warning.                               Subtraction                     0012                                                                                                                   Subtraction                     0013                                 2. If the precision of the result exceeds the defined precision                   Subtraction                     0014                                    of a receiving variable (and the variable has not been defined                 Subtraction                     0015                                    for automatic rounding), the result will be truncated on the                   Subtraction                     0016                                    right-hand side. See the <ROUND,#HELPMT3> statement for more                   Subtraction                     0017                                    information.                                                                   Subtraction                     0018                                                                                                                   Subtraction                     0019                                 Also see <the LET statement|LET,#HELPMT4>.                                        Subtraction                     0020                                                                                                                   Subtraction                     0021                              Example:                                                                             Subtraction                     0022                                                                                                                   Subtraction                     0023                                 LENGTH 5.0                 ! Declare the length for A, B, C                       Subtraction                     0024                                 LOCAL A, B, C              ! Declare them as LOCAL variables                      Subtraction                     0025                                 .                                                                                 Subtraction                     0026                                 LET A = 800                ! Set the value for A                                  Subtraction                     0027                                 LET B = 200                ! Set the value for B                                  Subtraction                     0028                                 LET C = A - B              ! Subtract B from A, giving C                          Text files                      0001                              Text files                                                                           Text files                      0002                              ==========                                                                           Text files                      0003                                                                                                                   Text files                      0004                                 Text files are standard ASCII data files containing text records.                 Text files                      0005                                 Records are stored in the order in which they were written to the                 Text files                      0006                                 file, and are accessible in sequential order. Text files employ a                 Text files                      0007                                 fixed record size of 1,024 bytes, however, a carriage return/line                 Text files                      0008                                 feed terminates each record following the final byte of data in                   Text files                      0009                                 the record. Fields are variable-sized, and may or may not be                      Text files                      0010                                 delimited (depending on the application that created the text                     Text files                      0011                                 file).                                                                            Text files                      0012                                                                                                                   Text files                      0013                                 Text files are primarily used to import and export standard ASCII                 Text files                      0014                                 files with Comet. They may also be used to store MTB source                       Text files                      0015                                 programs, as the MTB compiler supports both text files and Comet                  Text files                      0016                                 editor keyed files as source files.                                               Underscore and ampersand        0001                              Underscore and ampersand                                                             Underscore and ampersand        0002                              ========================                                                             Underscore and ampersand        0003                                                                                                                   Underscore and ampersand        0004                                 The line continuation (_) and multiple statement on a line (:)                    Underscore and ampersand        0005                                 characters can be combined to produce a connected and structured                  Underscore and ampersand        0006                                 code block. For example, the following IF/THEN statement includes                 Underscore and ampersand        0007                                 multiple actions to be taken if the condition is true:                            Underscore and ampersand        0008                                                                                                                   Underscore and ampersand        0009                                    IF OPTION$="QUIT" THEN_                                                        Underscore and ampersand        0010                                    CLOSE (1) &_                                                                   Underscore and ampersand        0011                                    PRINT (0) "STOPPING PROGRAM NOW." &_                                           Underscore and ampersand        0012                                    PRINT (0) "PRESS ENTER TO CONTINUE." &_                                        Underscore and ampersand        0013                                    INPUT (0) "" &_                                                                Underscore and ampersand        0014                                    RUN "QMONITOR"                                                                 Underscore and ampersand        0015                                                                                                                   Underscore and ampersand        0016                                 Note: This example could also be written with the IF/ENDIF                        Underscore and ampersand        0017                                 structure. In that case, the line continuation and multiple                       Underscore and ampersand        0018                                 statements characters would not be used. For more information,                    Underscore and ampersand        0019                                 see <the IF statement|IF,#HELPMT4>.                                               Usefiles                        0001                              Usefiles                                                                             Usefiles                        0002                              ========                                                                             Usefiles                        0003                                                                                                                   Usefiles                        0004                                 Usefiles are sections of an MTB source program that are intended                  Usefiles                        0005                                 to be merged into main programs at compile time. In a way,                        Usefiles                        0006                                 usefiles are similar to subroutine source code libraries in other                 Usefiles                        0007                                 computer languages, and "include" libraries in some data base                     Usefiles                        0008                                 packages.                                                                         Usefiles                        0009                                                                                                                   Usefiles                        0010                                 In an application system, for example, a definition of the fields                 Usefiles                        0011                                 and format for a particular data file will be used in all of the                  Usefiles                        0012                                 programs reading and/or writing that file. It is therefore more                   Usefiles                        0013                                 practical to include the field and format definitions in a single                 Usefiles                        0014                                 source file (called a usefile). This single source file may then                  Usefiles                        0015                                 be merged into the object program at compilation time.                            Usefiles                        0016                                                                                                                   Usefiles                        0017                                 The following diagram shows how usefiles are used. The main                       Usefiles                        0018                                 source program is written with the assumption that various                        Usefiles                        0019                                 usefiles exist. These usefiles could contain data definitions,                    Usefiles                        0020                                 formatting commands, processing routines, etc. When the main                      Usefiles                        0021                                 program is compiled, the usefiles are merged into the main                        Usefiles                        0022                                 program. The resulting object program contains the definitions,                   Usefiles                        0023                                 format commands, and instructions from the main program and all                   Usefiles                        0024                                 of the usefiles called.                                                           Usefiles                        0025                                                                                                                   Usefiles                        0026                                 -----------------------                ----------------                           Usefiles                        0027                                 |   Main source file  |                | Usefile 1    |                           Usefiles                        0028                                 |                     |                |              |                           Usefiles                        0029                                 |                     |----------------|              |                           Usefiles                        0030                                 |                     |                |              |                           Usefiles                        0031                                 |                     |                |              |                           Usefiles                        0032                                 |                     |                ----------------                           Usefiles                        0033                                 |                     |                                                           Usefiles                        0034                                 |                     |                ----------------                           Usefiles                        0035                                 |                     |                | Usefile 2    |                           Usefiles                        0036                                 |                     |                |              |                           Usefiles                        0037                                 |                     |----------------|              |                           Usefiles                        0038                                 |                     |                |              |                           Usefiles                        0039                                 |                     |                |              |                           Usefiles                        0040                                 -----------------------                ----------------                           Usefiles                        0041                                                                                                                   Usefiles                        0042                                 Usefiles are created the same way as source files, namely with                    Usefiles                        0043                                 the Comet editor program or with a standard text editor/word                      Usefiles                        0044                                 processor.                                                                        Usefiles                        0045                                                                                                                   Usefiles                        0046                                 To merge a usefile into the main object program, you must include                 Usefiles                        0047                                 a statement in the main source program. The MTB statement used to                 Usefiles                        0048                                 merge a usefile is USE. The syntax is:                                            Usefiles                        0049                                                                                                                   Usefiles                        0050                                 USE "usefile-name"[,"directory-name"][,starting-edit-line-number]                 Usefiles                        0051                                                                                                                   Usefiles                        0052                                 The "usefile-name" parameter is the name of the MTB usefile to be                 Usefiles                        0053                                 merged. This name must be enclosed in matching quotation marks                    Usefiles                        0054                                 (single or double).                                                               Usefiles                        0055                                                                                                                   Usefiles                        0056                                 The "directory-name" parameter (optional) represents the name of                  Usefiles                        0057                                 the Comet directory where the usefile is stored.                                  Usefiles                        0058                                                                                                                   Usefiles                        0059                                 A single usefile can actually contain multiple segments of code                   Usefiles                        0060                                 to be merged into the main program. In these cases, the USE                       Usefiles                        0061                                 statement must specify the starting location in the usefile                       Usefiles                        0062                                 itself (otherwise the MTB compiler will start at the beginning of                 Usefiles                        0063                                 the usefile). The "starting-edit-line-number" (optional) is the                   Usefiles                        0064                                 editor line number in the usefile where the merging is to start.                  Usefiles                        0065                                                                                                                   Usefiles                        0066                                 Note: If you include multiple program segments in a single                        Usefiles                        0067                                 usefile, you must conclude each segment with the ENDUSE                           Usefiles                        0068                                 statement. This way, the compiler will merge lines up to the                      Usefiles                        0069                                 ENDUSE statement, but not beyond.                                                 Usefiles                        0070                                                                                                                   Usefiles                        0071                                 The USE statement can appear anywhere in an MTB source program.                   Usefiles                        0072                                 The statements in the usefile will be merged into the program                     Usefiles                        0073                                 section where the USE statement appears. Therefore, the usefile                   Usefiles                        0074                                 must contain the same kind of statements  Data Division, I/O                     Usefiles                        0075                                 Format Division, or Procedure Division  as the section of the                    Usefiles                        0076                                 program where the USE statement appears.                                          Usefiles                        0077                                                                                                                   Usefiles                        0078                                 The USE statements may be nested to two levels. This means that a                 Usefiles                        0079                                 usefile may contain another USE statement. In this case, the                      Usefiles                        0080                                 secondary level program lines will be merged into the primary                     Usefiles                        0081                                 usefile, and those lines will be merged into the main object                      Usefiles                        0082                                 program.                                                                          Usefiles                        0083                                                                                                                   Usefiles                        0084                              Example:                                                                             Usefiles                        0085                                                                                                                   Usefiles                        0086                                 The following example shows a main program that merges a single                   Usefiles                        0087                                 usefile into the resulting object program at compile time. The                    Usefiles                        0088                                 usefile is called "CUST" -- the editor line numbers are shown for                 Usefiles                        0089                                 reference purposes only.                                                          Usefiles                        0090                                                                                                                   Usefiles                        0091                              Main program                                                                         Usefiles                        0092                              ============                                                                         Usefiles                        0093                                                                                                                   Usefiles                        0094                                 Editor                                                                            Usefiles                        0095                                 line                                                                              Usefiles                        0096                                 number   MTB source statement                                                     Usefiles                        0097                                 =================================================================                 Usefiles                        0098                                 100      LENGTH 1 & LOCAL OPTION$                                                 Usefiles                        0099                                 200      LENGTH 5 & LOCAL FLAG$                                                   Usefiles                        0100                                 300      USE "CUST"                                                               Usefiles                        0101                                 400      .                                                                        Usefiles                        0102                                 500      .                                                                        Usefiles                        0103                                 600      .                                                                        Usefiles                        0104                                                                                                                   Usefiles                        0105                                                                                                                   Usefiles                        0106                              Usefile named "CUST"                                                                 Usefiles                        0107                              ====================                                                                 Usefiles                        0108                                                                                                                   Usefiles                        0109                                 Editor                                                                            Usefiles                        0110                                 line                                                                              Usefiles                        0111                                 number   MTB source statement                                                     Usefiles                        0112                                 =================================================================                 Usefiles                        0113                                 1000     LENGTH 5 & LOCAL CUSTNUM$                                                Usefiles                        0114                                 1100     LENGTH 30                                                                Usefiles                        0115                                 1200       LOCAL CUSTNAME$,ADDRESS$                                               Usefiles                        0116                                 1300     LENGTH 15 & LOCAL CITY$                                                  Usefiles                        0117                                 1400     LENGTH 2 & LOCAL STATE$                                                  Usefiles                        0118                                 1500     LENGTH 10 & LOCAL ZIPCODE$                                               Usefiles                        0119                                 1600     LENGTH 20 & LOCAL CONTACT$                                               Usefiles                        0120                                 1700     LENGTH 20 & LOCAL TITLE$                                                 Usefiles                        0121                                 1800     LENGTH 12 & LOCAL PHONE$                                                 Usefiles                        0122                                 1900     !                                                                        Usefiles                        0123                                 2000     1000 FORMAT_                                                             Usefiles                        0124                                 2100          CUSTNUM$;_                                                          Usefiles                        0125                                 2200          CUSTNAME$;_                                                         Usefiles                        0126                                 2300          ADDRESS$;_                                                          Usefiles                        0127                                 2400          CITY$;_                                                             Usefiles                        0128                                 2500          ZIPCODE$;_                                                          Usefiles                        0129                                 2600          CONTACT$;_                                                          Usefiles                        0130                                 2700          TITLE$;_                                                            Usefiles                        0131                                 2800          PHONE$                                                              Using the MTB Compiler          0001                              Using the MTB Compiler                                                               Using the MTB Compiler          0002                              ======================                                                               Using the MTB Compiler          0003                                                                                                                   Using the MTB Compiler          0004                                 <Creating MTB Source Programs>                                                    Using the MTB Compiler          0005                                 <Compiling MTB Programs>                                                          Using the MTB Compiler          0006                                 <Compiler Directives>                                                             Using the MTB Compiler          0007                                                                                                                   Using the MTB Compiler          0008                                 MTB is a compiler language. As such, MTB programs must be written                 Using the MTB Compiler          0009                                 in source form, then compiled into object (machine language)                      Using the MTB Compiler          0010                                 format. The translation process is accomplished with the MTB                      Using the MTB Compiler          0011                                 compiler.                                                                         Using the MTB Compiler          0012                                                                                                                   Using the MTB Compiler          0013                                 Once a program has been compiled into its object form, only the                   Using the MTB Compiler          0014                                 object is required in order to run the program. The source is not                 Using the MTB Compiler          0015                                 required unless changes are made to the program. In that case,                    Using the MTB Compiler          0016                                 the changes are made in the source program and the source program                 Using the MTB Compiler          0017                                 is re-translated into a new version of the object program.                        Addition                                                             Also see the notes about <Precedence>.                                            Command Mode                                                         "#MTB" will be displayed in the "Options" field.                                  Comment Character                                                    ENDIF                                                                             Compiler Directives                                                                                                                                    Compiling MTB Programs                                               Also see <Compiling MTB Programs>                                                 Copyright                                                                                                                                              Creating MTB Source Programs                                         is re-translated into a new version of the object program.                        Data Types                                                           the line.                                                                         Division                                                             LET C = A * B              ! Multiply A and B, giving C                           File I/O Operations                                                     space in image format.                                                         HOME                                                                 First on-line edition September 1996.                                             Indentation                                                          see <the IF statement|IF,#HELPMT4>.                                               Indexed Sequential files                                             Also see <Record Types>.                                                          Interactive Mode                                                     XMAINT         MAINT                                                              Introduction to MoreThanBasic                                        <Index|INDEX,#HELPMTB>                                                            Keyed files                                                          Also see <Record Types> and <File I/O Operations>.                                Language Structure                                                      statements designed just for business applications purposes.                   Line Numbers vs. Labels                                              additional information.                                                           Logical Operations                                                      characters).                                                                   Modulo                                                               LET C = A / B              ! Divide A by B, giving C                              Multiple Statements on a Line                                        on the same line). Both methods are valid.                                        Multiplication                                                       LET C = A - B              ! Subtract B from A, giving C                          Notation Conventions                                                 of the source program, rather than two.                                           Numeric Operations                                                   the <Procedure Division,#HELPMT4> documentation.                                  Operations                                                           the <Data Division,#HELPMT3> documentation.                                       Overview of the Comet File Syste                                        ENDIF                                                                          Precedence                                                           equals 3 with a remainder of 1.                                                   Record Types                                                         editor keyed files as source files.                                               Relational Operations                                                WARNING OF ANY KIND.                                                              Source Program Divisions                                             <Subprograms>                                                                     Statement Continuation                                               be written after the THEN clause of an IF statement.                              String Operations                                                    precision.                                                                        Subprograms                                                          2800          PHONE$                                                              Subtraction                                                          LET C = A + B              ! Add A and B, giving C                                Text files                                                           Also see <Record Types>.                                                          Underscore and ampersand                                             purposes only).                                                                   Usefiles                                                             operations, see the <IF,#HELPMT4> statement.                                      Using the MTB Compiler                                                  <ORD,#HELPMT4>                                                                 